Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-10-2011, 04:52 PM
|
#1
|
LQ Newbie
Registered: Jan 2011
Posts: 2
Rep:
|
Name based virtual hosting not working
I've been trying to get my name-based server to work for a week now. I've read about everything there is and double checked my configs, but when I go to any of my sites, it always goes to the first virtual host.
Here is my Webmin system info -
Quote:
System hostname localhost.localdomain
Operating system Redhat Linux Fedora 11
Webmin version 1.530
Time on system Mon Jan 10 15:36:23 2011
Kernel and CPU Linux 2.6.30.10-105.2.23.fc11.x86_64 on x86_64
Processor information AMD Athlon(tm) II X2 245 Processor, 2 cores
System uptime 2 hours, 18 minutes
Running processes 146
CPU load averages 0.00 (1 min) 0.00 (5 mins) 0.00 (15 mins)
CPU usage 6% user, 4% kernel, 0% IO, 89% idle
Real memory 1.70 GB total, 446.65 MB used
Virtual memory 3.41 GB total, 0 bytes used
Local disk space 455.09 GB total, 37.82 GB used
Package updates All installed packages are up to date
|
Here is the end of my httpd.conf file:
Code:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/musicon11
ServerName musicon11.com
<Directory "/var/www/html/musicon11">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/35x40
ServerName 35x40productions.com
<Directory "/var/www/html/35x40">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/oin
ServerName oklahomaindienow.com
<Directory "/var/www/html/oin">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
Your help is appreciated!
|
|
|
01-10-2011, 05:27 PM
|
#2
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
|
Hi,
You should check you dns settings
Code:
host musicon11.com
host 35x40productions.com
host oklahomaindienow.com
From here the last 2 domains resolve to the same IP, while the 1st to a different one
|
|
|
01-10-2011, 08:27 PM
|
#3
|
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196
|
It doesn't matter that all names resolve to the same IP. After all that is what you want with name-based VH, all sites resolve to the same server and let the server figure out what Virtual Domain has to be served from the name.
The problem is that you specify servername yourdomain.com but this will not match www.youdomain.com. To achieve that, you need an additional statement:
serveralias yourdomain.com *.yourdomain.com
in the stanza between
<virtualhost>
...
serveralias yourdomain.com *.yourdomain.com
...
...
</virtualhost>
jlinkels
|
|
|
01-11-2011, 12:11 PM
|
#4
|
LQ Newbie
Registered: Jan 2011
Posts: 2
Original Poster
Rep:
|
Still not working
Thank you for your prompt responses.
I tried bathory's solution to no avail. I started to look through my DNS listings and how my pointing services worked and I think I might be on to something. here is my dig info I am going over.
Code:
dig musicon11.com
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> musicon11.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42472
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3
;; QUESTION SECTION:
;musicon11.com. IN A
;; ANSWER SECTION:
musicon11.com. 300 IN A 68.99.70.130
;; AUTHORITY SECTION:
musicon11.com. 167579 IN NS ns3.mdnsservice.com.
musicon11.com. 167579 IN NS ns1.mdnsservice.com.
musicon11.com. 167579 IN NS ns2.mdnsservice.com.
;; ADDITIONAL SECTION:
ns1.mdnsservice.com. 168 IN A 216.40.47.18
ns2.mdnsservice.com. 168 IN A 64.98.148.11
ns3.mdnsservice.com. 168 IN A 65.22.7.10
;; Query time: 54 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:50:39 2011
;; MSG SIZE rcvd: 161
> dig oklahomaindienowcom
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> oklahomaindienowcom
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 14881
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;oklahomaindienowcom. IN A
;; AUTHORITY SECTION:
. 900 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2011011001 1800 900 604800 86400
;; Query time: 60 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:50:51 2011
;; MSG SIZE rcvd: 112
> dig 35x40productions.com
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> 35x40productions.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60776
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;35x40productions.com. IN A
;; ANSWER SECTION:
35x40productions.com. 716 IN A 65.254.248.143
;; AUTHORITY SECTION:
35x40productions.com. 169916 IN NS ns1.fatcow.com.
35x40productions.com. 169916 IN NS ns2.fatcow.com.
;; ADDITIONAL SECTION:
ns1.fatcow.com. 3291 IN A 65.254.254.100
ns2.fatcow.com. 1515 IN A 65.254.254.101
;; Query time: 11 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:51:09 2011
;; MSG SIZE rcvd: 129
> dig 68.99.70.130
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> 68.99.70.130
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 42254
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;68.99.70.130. IN A
;; AUTHORITY SECTION:
. 900 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2011011001 1800 900 604800 86400
;; Query time: 51 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:51:33 2011
;; MSG SIZE rcvd: 105
> dig oklahomaindienow.com
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> oklahomaindienow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47098
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;oklahomaindienow.com. IN A
;; ANSWER SECTION:
oklahomaindienow.com. 3600 IN A 65.254.248.143
;; AUTHORITY SECTION:
oklahomaindienow.com. 172800 IN NS ns1.fatcow.com.
oklahomaindienow.com. 172800 IN NS ns2.fatcow.com.
;; ADDITIONAL SECTION:
ns1.fatcow.com. 3163 IN A 65.254.254.100
ns2.fatcow.com. 1387 IN A 65.254.254.101
;; Query time: 207 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:53:16 2011
;; MSG SIZE rcvd: 129
> dig 65.254.248.143
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> 65.254.248.143
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 54197
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;65.254.248.143. IN A
;; AUTHORITY SECTION:
. 900 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2011011001 1800 900 604800 86400
;; Query time: 55 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:54:05 2011
;; MSG SIZE rcvd: 107
here is my current httpd file (just the vhosts part)
Code:
#NameVirtualHost 68.99.70.130:80
NameVirtualHost *:80
ServerName 35x40productions
<VirtualHost *:80>
DocumentRoot "/var/www/html/musicon11"
ServerName musicon11.com
ServerAlias musicon11.com *.musicon11.com*
<Directory "/var/www/html/musicon11">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/35x40"
ServerName 35x40productions.com
ServerAlias 35x40productions.com *.35x40productions.com*
<Directory "/var/www/html/35x40">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
I'm going to keep working on it. Any guidance or suggestions would be appreciated.
|
|
|
01-11-2011, 01:00 PM
|
#5
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
|
Hi,
It's not going to work as long as long as musicon11.com and 35x40productions.com resolve to 2 different IP addresses.
Are you sure you mean Name virtual hosts and not IP-based virtual hosts. If your webserver listens on both IPs and you want to setup a vhost per IP, you need IP-based vhosts. Take a look at apache documentation to see the difference and the needed configuration for each case.
Regards
|
|
|
01-11-2011, 03:29 PM
|
#6
|
LQ Guru
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196
|
@bathory: why is it not allowed to resolve the two domains to different IP addresses? Since no IP address is specified in the config file, Apache should not care about IP address. I have one server set up which is accessed thru different IP addresses and ports but using only the VH config just like krazynotez does it.
Whatever, it is recommended to use the httpd -S option during start of Apache to get information about how Apache parses the config file.
jlinkels
|
|
|
01-11-2011, 04:23 PM
|
#7
|
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
|
@jlinkels
Quote:
@bathory: why is it not allowed to resolve the two domains to different IP addresses? Since no IP address is specified in the config file, Apache should not care about IP address. I have one server set up which is accessed thru different IP addresses and ports but using only the VH config just like krazynotez does it.
|
I didn't say that. I said that with different IPs the Named-based vhosts are not going to work, so OP needs to use IP-based vhosts.
I guess your setup works because you're using different IPs and ports.
Regards
|
|
|
All times are GMT -5. The time now is 09:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|