Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Configuring a Virtual Name Server /apache/ and Sarge

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
T.R
Posts: 1
Joined: 2005-10-28 16:43

Configuring a Virtual Name Server /apache/ and Sarge

#1 Post by T.R »

Hi there friends.
I have been trying for a week now to set up my home web server to host two websites using the NameServer and one IP for both sites. I have active DNS addresses for both and the primary first website works fine.

I cannot seem to get the second website to work with using the NameServer directives. I know only what I read from the Debian instructions and also the apache documents. I at first was using the wrong directive that is included with the Debian install instuctions under networking. I read down another paragraph and now I see that I should use the simple directive for NameServer as follows.

NameVirtualHost *
<VirtualHost *>
ServerName www.xxx.xxxxxxxx.net
DocumentRoot /www/xxx.xxxxxxxx.net
</VirtualHost>

<VirtualHost *>
ServerName www.xxxx.xxxxxx.net
DocumentRoot /www/xxxx.xxxxxx.net
</VirtualHost>

I restart apache with init.d and get no errors however the first primary site does not work.

If there is a better readme out there and more examples with regard to the proper way to make subdirectories for using a NameServer and 1 IP.
At this point I just am not sure what the problem is but I feel it may be in the naming and location of folders for the second website. Any input would be appreciated.

Thanks
Tom

PopsTX
Posts: 18
Joined: 2005-07-15 23:01
Location: Kermit, Tx

Getting Started

#2 Post by PopsTX »

Tom;

Making some assumptions here... running Apache2 and you have the virtual servers (web sites) set up properly in /etc/apache2/sites-enabled and you're accessing the whole thing through a router of some type.

Although one IPA is recognized: When the other 'Name/Number' is requested the router and server does not know what to do... You'll have to set up the IP addresses at the router level (with the router's admin panel) AND/OR at /etc/network/interfaces: Depending on how the hardware is actually set up.

As far as creating the directories is concerned: Again, making some assumptions.

You may create the directories where ever you have set up the "web root" folder. e.g: /var/www/Site1/htdocs/ where 'htdocs' being the DOCUMENT root for Site1 and containing all of Site1's subdirectories.

The document structure is "enhanced" with EACH site's file in /etc/apache2/sites-enabled. e.g.Site1 would have a config file named "Site1" in /etc/apache2/sites-enabled.

The example below is a modified copy of one I'm using at the moment. It MUST be changed as my server is only accessible from my in-house network but, it'll get you started.

You should also know... There several other config files that need to be attended to, depending on one's actual needs.

Code: Select all

NameVirtualHost 192.168.0.10
# FILE: /etc/apache2/sites-available/web1
# This is the config file for web1 virtual sever
##
##
##
<VirtualHost 192.168.0.10>
	ServerAdmin YourEmailAddress@SomeDomain.com
	DocumentRoot /home/MyHomeFolder/web1/httpdocs
	ServerName Tuxley:80
	ServerAlias 192.168.0.10
	#<Directory >
	#	Options FollowSymLinks
	#	AllowOverride all
	#</Directory>
	<Directory "/home/MyHomeFolder/web1/httpdocs">
		Options Indexes FollowSymLinks MultiViews
		AllowOverride all
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /home/MyHomeFolder/web1/httpdocs/cgi-bin/
	
  <Directory "/home/MyHomeFolder/web1/httpdocs/cgi-bin">
		AllowOverride all
		Options ExecCGI FollowSymLinks
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog /home/MyHomeFolder/web1/logs/error.log

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

	CustomLog /home/MyHomeFolder/web1/logs/access.log combined
	ServerSignature On

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

</VirtualHost>
Even if you are on the right track, you'll get run over if you just sit there.

Guest

#3 Post by Guest »

Thanks for the reply and information. I finally made it work, the problem was the use of the assigned IP from the EasyDNS. I was using the machine IP and should have used the new IP they assigned.

I need very little with respect to making configuration changes. I just have a PHP music server running without any mail services or anything that needs monitoring. This is just a good learning experience for me to be able to have and maintain a server that cost absolutely nothing ! The added ability to make a second or third or fourth music server just makes it even better. I can drop an address at different places with a slightly different content and identity.


Thanks
Tom

Post Reply