aurir_ Posted October 25, 2008 Share Posted October 25, 2008 I have a couple of domain names registered to me, and I use one of the features, namely URL Forwarding, to point them to my server. I also have a couple of virtual hosts defined. However, when I type in my domain names in the browser, apache always loads the default website. I did a little experiment, and I added those domains to a host file, and apache loads the correct pages. What do I have to do, so that virtual hosting works with URL forwarding? Is it even possible? Will I have to create my own DNS server, and set it as the primary DNS server for my domains(I saw that there is such an option)? Quote Link to comment Share on other sites More sharing options...
corbin Posted October 25, 2008 Share Posted October 25, 2008 How are the domains forwarded? Are they just forwarded to the server IP or are they remapped to a different domain name somehow? Quote Link to comment Share on other sites More sharing options...
aurir_ Posted October 25, 2008 Author Share Posted October 25, 2008 They are forwarded to an IP. Quote Link to comment Share on other sites More sharing options...
corbin Posted October 25, 2008 Share Posted October 25, 2008 So what is your vhost setup? It should work fine. Quote Link to comment Share on other sites More sharing options...
aurir_ Posted October 25, 2008 Author Share Posted October 25, 2008 NameVirtualHost * <VirtualHost *> ServerAdmin webmaster@localhost ServerName mywebsite.com ServerAlias *.mywebsite.com DocumentRoot /var/www/mywebsite <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> 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 ServerSignature On 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> Quote Link to comment Share on other sites More sharing options...
corbin Posted October 25, 2008 Share Posted October 25, 2008 There's your problem. You need more than 1 virtual host.... NameVirtualHost * <VirtualHost *> ServerName site1.com DocumentRoot /some/where/ </VirtualHost> <VirtualHost *> ServerName site2.com DocumentRoot /some/where_else/ </VirtualHost> Quote Link to comment Share on other sites More sharing options...
aurir_ Posted October 25, 2008 Author Share Posted October 25, 2008 I do have more than one virtual host. I just posted one of my virtual hosts config since all of them look the same except the names and directories change. You see, it's an Ubuntu server, and what they did is that instead of having all of the virtual hosts defined in one file, you have one file per virtual host. You can read about it at https://help.ubuntu.com/6.10/ubuntu/serverguide/C/httpd.html Besides, when I add my sites to a host file on one of the local computers, that configuration works. Quote Link to comment Share on other sites More sharing options...
corbin Posted October 26, 2008 Share Posted October 26, 2008 Is the main conf file including the vhost files? Quote Link to comment Share on other sites More sharing options...
aurir_ Posted October 30, 2008 Author Share Posted October 30, 2008 I resolved the problem. The apache virtual host configuration was fine. I believe, that the URL forwarding that I had, was simply going by the IP address and not domain name. So, I created my own Name Server, and registered it with my domain registrar, and it all works now. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.