Posted: 12/17/2004 12:50:57 PM EDT
|
I'm haveing a hell of a time trying to get someting so simple as virtual hosts to work. running it on windows xp. Have created appropriate directories and web pages. I just can't get it to find the Server2 web page. here is what i have MYIP and domain names have been edited. I actaully have my ip in for MYIP. #NameVirtualHost * # ***************************** NameVirtualHost MYIP:80 # ***************************** <VirtualHost MYIP:80> ServerName server.no-ip.com DocumentRoot /htdocs </VirtualHost> <VirtualHost MYIP:80> ServerName server2.no-ip.com DocumentRoot /htdocs/hidden </VirtualHost> i have restarted the service and it still doesn't work. am i forgetting a configureation somewere else? its driving me up a wall!!!!!! ![]() |
i have a router that is redirecting any port 80 traffic to my web server that is on an internal address. The IP address in httpd.conf is my external address.![]() my isp doesn't block 80 i am refferencing the virtual host section off my backed up httpd.conf file from my last web server, and it was able to hand out the right page based on the url request. |
|
my httpd.conf on linux looks like this,using afrcom as an example host : arfcom.no-ip.com goes to /var/www/html/arfcom.no-ip.com arfcom.d2g.com goes to /var/www/html/arfcom.d2g.com <snip> # # Use name-based virtual hosting. # NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *> # ServerAdmin [email protected] # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com # ErrorLog logs/dummy-host.example.com-error_log # CustomLog logs/dummy-host.example.com-access_log common #</VirtualHost> <VirtualHost *> ServerAdmin [email protected] DocumentRoot /var/www/html/arfcom.no-ip.com ServerName arfcom.no-ip.com ServerAlias arfcom.no-ip.com ErrorLog logs/arfcom.no-ip.com-error_log CustomLog logs/arfcom.no-ip.com-access_log common </VirtualHost> <VirtualHost *> ServerAdmin [email protected] DocumentRoot /var/www/html/arfcom.d2g.com ServerName arfcom.d2g.com ServerAlias arfcom.d2g.com ErrorLog logs/arfcom.d2g.com-error_log CustomLog logs/arfcom.d2g.com-access_log common </VirtualHost> |
Tried that config with my info.. still didn't work. ![]() i was using apache 1.3 before now i'm on 2.0.52 maybe that makes a difference. |
|
Elementary, my dear Watson. Don't make the Document Root of one Virtual Host a subdirectory of another Virtual Host. Rather, I prefer this method (works great if you have to manage 80+ domains, like I do): <VirtualHost MYIP:80> ServerName server.no-ip.com DocumentRoot /htdocs/server.no-ip.com </VirtualHost> <VirtualHost MYIP:80> ServerName server2.no-ip.com DocumentRoot /htdocs/server2.no-ip.com </VirtualHost> You're welcome. |
its setup like that right now but now i just get an index page that shows my folders under /htdocs. whats with that!? why is it acting like its not even caring what httpd.conf has to say? |
Ah, I see. What hostname are you using to try and access the server? You're behind a firewall/NAT device? Does your internal name server resolve server.no-ip.com to your server's private address? |
|
Oh crap, I just realized something. Your using a public IP address in the VirtualHost tags, but your server has a private address bound. I don't know why I didn't catch this before. Replace "MYIP:80" with "*", unless you have a good reason why you don't want Apache bound to all interfaces. <VirtualHost *> <-- Like that I'm actually kind of suprised Apache started. Don't forget to restart Apache when you're done. |
Ok. No problem. We'll get this fixed up for ya, promise. What's your server's public address? Is server.no-ip.com and server2.no-ip.com the real hostnames (they resolve correctly, I noticed)? |

