Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 5th November 2009, 10:11
wiewioor wiewioor is offline
Junior Member
 
Join Date: Jul 2009
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Multiple websites on Apache 2.2

Hello All!

I've been running one site on Apache in a LAN network without any problems. But now I must run two sites on the same server.

Both sites are in separate folders on the server but only one is running right (the first one I've set up).

The new site is not displaying in browsers over the LAN at all ("Conection with server has been reset/lost during site load' - my translation) and on the PC where the server is it only displays pure .html (It Works! for instance) but not .php .

Maybe my VirtualHosts are not set up properly?
First site (working):
Code:
<VirtualHost 192.168.5.222:80>
	ServerAdmin webmaster@localhost
	
	DocumentRoot /var/www/joomla/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/joomla/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
Second site (not working)
Code:
<VirtualHost 192.168.5.222:81>
	ServerAdmin webmaster@localhost
	DirectoryIndex index.html index.php
	DocumentRoot /var/www/f16niesprawnosci/www/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
		Order deny,allow
		Deny from all
	</Directory>
	<Directory /var/www/f16niesprawnosci/>
		Options Indexes FollowSymLinks
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel debug

	CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
And my ports.conf
Code:
NameVirtualHost 192.168.5.222:80
Listen 80

NameVirtualHost 192.168.5.222:81
Listen 81

<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    Listen 443
</IfModule>
apache2.conf
Code:
#

ServerRoot "/etc/apache2"

LockFile /var/lock/apache2/accept.lock

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

DefaultType text/plain

HostnameLookups Off

ErrorLog /var/log/apache2/error.log

LogLevel warn

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
I've been going through log files but found nothing.
Any ideas? More info to give You better picture?
All help will be appreciated.
Reply With Quote
Sponsored Links
  #2  
Old 5th November 2009, 12:23
dalitso dalitso is offline
Member
 
Join Date: Nov 2008
Location: South Africa
Posts: 43
Thanks: 3
Thanked 4 Times in 3 Posts
Send a message via Skype™ to dalitso
 
Default

I have managed to run more than 1 apache site site before using either a IP-based hosts or Name-based virtual hosts http://httpd.apache.org/docs/1.3/vhosts/name-based.html

IP-based hosts is a simpler one for you do not need to configure DNS as opposed to Name-based where you need DNS to resolve the name of the virtual server.

With IP-based, you need to create a virtual network interface under eth0. You can name it eth0:1

Unfortunately, I only know how to create a virtual interface using webmin. So I can help you if you are familiar with webmin or you are willing to try webmin. Webmin is easy to learn anyway.

The only disadvantage of IP-based hosts that I have noticed is that you can only host one site at a time over the internet should you require to make your sites available on the internet. On your LAN its ok though because you can simply browse to the correct IP address.

Having that in mind, I would say name based hosts is much better, it uses one IP address for all apache virtual hosts. Its also easy to setup using webmin and virtualmin. Virtualmin will automatically handle your DNS settings for you.

I'm not sure if there are ways of overcoming that limitation in IP-based hosts, I'm just speaking from my knowledge and experience.

Let me know when you are ready.
Reply With Quote
Reply

Bookmarks

Tags
apache, multiple sites, server, two sites

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with suexec gobokster Installation/Configuration 7 7th May 2009 13:33
CENTOS 5 Ping Problem gAnDo Server Operation 11 28th March 2008 20:58
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 15:47
mod_mono apache 2.2 ColdDoT Server Operation 5 23rd May 2006 02:58
Problem with the installation of Dokeos (LMS) in ISPConfig jofranco General 4 28th April 2006 00:45


All times are GMT +2. The time now is 06:17.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.