I have 3 virtualhosts on an apache2 running on a debian 2.6.8 stable . I don't understand why the site still being reachable , when i restart apache2 , it shows this error: Code: root@www:~# /etc/init.d/apache2 restart Forcing reload of web server: Apache2[Thu Feb 01 10:13:45 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts [Thu Feb 01 10:13:45 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts It happens only for the site above , and all sites have same virtualhost in pache2.conf and dir /etc/apache2/sites-enabled here the apache2.conf: Code: <VirtualHost tor.gabrix.ath.cx> ServerName tor.gabrix.ath.cx ServerAlias tor.gabrix.cx ServerAdmin [email protected] DocumentRoot /var/www/torgab ErrorLog /var/log/apache2/tor_error.log TransferLog /var/log/apache2/tor_access.log <IfModule mod_security.c> CustomLog /var/log/apache2/tor_modsec_custom_log \ "%h %l %u %t \"%r\" %>s %b %{mod_security-message}i" \ env=mod_security-relevant </IfModule> </VirtualHost> <VirtualHost www.gabrix.ath.cx> ServerName www.gabrix.ath.cx ServerAlias www.gabrix.cx ServerAdmin [email protected] DocumentRoot /var/www/gabrix ErrorLog /var/log/apache2/gabrix_error.log TransferLog /var/log/apache2/gabrix_access.log <IfModule mod_security.c> CustomLog /var/log/apache2/gabrix_modsec_custom_log \ "%h %l %u %t \"%r\" %>s %b %{mod_security-message}i" \ env=mod_security-relevant </IfModule> </VirtualHost> <VirtualHost x.gabrix.ath.cx> ServerName x.gabrix.ath.cx ServerAlias x.gabrix.cx ServerAdmin [email protected] DocumentRoot /var/www/ics ErrorLog /var/log/apache2/x_error.log TransferLog /var/log/apache2/x_access.log <IfModule mod_security.c> CustomLog /var/log/apache2/x_modsec_custom_log \ "%h %l %u %t \"%r\" %>s %b %{mod_security-message}i" \ env=mod_security-relevant </IfModule> </VirtualHost> And this is the /etc/apache2/sites-enabled/ics file: Code: NameVirtualHost x.gabrix.ath.cx <VirtualHost x.gabrix.ath.cx> ServerAdmin [email protected] DocumentRoot /var/www/ics <Directory /> Options FollowSymLinks AllowOverride None Order allow,deny allow from 127.0.0.1/8 allow from 192.168.1.0/29 deny from all </Directory> <Directory /var/www/ics/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all # This directive allows us to have apache2's default start page # in /apache2-default/, but still have / go to the right place #RedirectMatch ^/$ /apache2-default/ </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/x_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/x_access.log combined ServerSignature Off 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> This morning i added the first page of content and i had back a "page not found" but maybe it's an another issue . ciao.
Code: NameVirtualHost x.gabrix.ath.cx NameVirtualHost must be followed by an IP address, not an FQDN.
Why x.gabrix.ath.cx is the only between them 3 to have an ip ? Anyway didn't work like this either ...
Forgive me i changed configuration in all possible maners, but i don't manaage to get it to work.Where should the ip go in the apache2.conf file or sites-enabled dir ? Ho i sould i configure the default virtualhost ? with a * or ip ?And where does the NameVirualHost directive go ?
You should update both NameVirtualHost and VirtualHost. You can use a *, and as such it will be active for every IP on your system, of you can use a single IP, in which case the block is only valid for that IP address Code: [COLOR="Red"]NameVirtualHost * <VirtualHost *>[/COLOR] ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options None Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options None #Options Indexes FollowSymLinks MultiViews Options FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <snipped rest of file>
That's how i have set the 3 virtualhost on my apache2 And i keep on getting this error: Do i have to name also the port it listen to ?Is it because the default virtualhost has to be mensioned explicitly ? Still with yhe default virtualhost on *. I get the error:
Maybe you're making the modifications to the config file apache2 is not using? See Code: httpd -V for the initial config file and work from there.
Yes, and httpd is the name of the Apache(2) program actually running. You will see when you execute the command.
My virtual hosts are configured just like as you see in my first post and instead of fqdn there are ips as you sayd so it's not ok !!!
So you use for you config file. Good. In your 1st post you showed us (part of?) this file. Can you check if you have a line reading Code: Include /etc/apache2/sites-enabled/[^.#]* in this apache2.conf file?
Try updating /etc/hosts If you are behind a NAT/firewall, probably your webserver has a local IP address (probably 192.168.xxx.xxx) and your router/firewall is responsible for forwarding incoming requests to your webserver. In this situation, you have a public IP address for your www.yourdomain.com but, in fact, Apache has to accept requests in your local interface instead of your public IP address (assigned to your router/firewall in fact). Try something like this in your /etc/hosts: Code: 127.0.0.1 localhost # these lines MUST be kept otherwise Apache2 fail serving these addresses 192.168.1.2 subdomain11.yourdomain1.com 192.168.1.2 subdomain12.yourdomain1.com 192.168.1.2 subdomain13.yourdomain1.com 192.168.1.2 subdomain21.yourdomain2.com 192.168.1.2 subdomain22.yourdomain2.com 192.168.1.2 subdomain23.yourdomain2.com # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts Enjoy
Hello there .. I have the same problem. I'm reading almost everything in the network about it and still under apache 1.3.37 it doesn't work. My NameVirtualHost is the IP of the machine. For example NameVirtualHost 123.123.123.123:80 <VirtualHost 123.123.123.123:80> Documen Root /somewhere/subdomain ServerName www.subdomain.mydomain.com ErrorLog logs/bla.error_log </VirtualHost> And I get the error: [Fri Mar 23 02:25:42 2007] [warn] NameVirtualHost 123.123.123.123:80 has no VirtualHosts /usr/local/apache/bin/apachectl start: httpd started