HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   NameVirtualHost www.mysite.it has no VirtualHosts (http://www.howtoforge.com/forums/showthread.php?t=10280)

gabrix 1st February 2007 11:29

NameVirtualHost www.mysite.it has no VirtualHosts
 
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 gabrix@gabrix.ath.cx
    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 gabrix@gabrix.ath.cx
    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 gabrix@gabrix.ath.cx
    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 webmaster@gabrix.ath.cx
       
        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.

falko 2nd February 2007 14:34

Code:

NameVirtualHost x.gabrix.ath.cx
NameVirtualHost must be followed by an IP address, not an FQDN.

gabrix 2nd February 2007 19:58

Why x.gabrix.ath.cx is the only between them 3 to have an ip ? Anyway didn't work like this either ...
Quote:

root@www:~# apache2ctl restart
[Fri Feb 02 18:56:16 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts
root@www:~# apache2ctl restart
[Fri Feb 02 18:56:19 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts

falko 3rd February 2007 15:36

You must change all NameVirtualHost directives. Each of them must take an IP address.

gabrix 4th February 2007 06:50

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 ?
Quote:

root@www:~# /etc/init.d/apache2 restart
Forcing reload of web server: Apache2[Sun Feb 04 05:44:03 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts
[Sun Feb 04 05:44:04 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts
Ho i sould i configure the default virtualhost ? with a * or ip ?And where does the NameVirualHost directive go ?

martinfst 4th February 2007 13:19

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:

NameVirtualHost *
<VirtualHost *>

        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>


gabrix 4th February 2007 16:10

That's how i have set the 3 virtualhost on my apache2
Quote:

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@gabrix.ath.cx

DocumentRoot /var/www/torgab
Quote:

NameVirtualHost 192.168.1.4
<VirtualHost 192.168.1.4>
Quote:

NameVirtualHost 192.168.1.4
<VirtualHost 192.168.1.4>
And i keep on getting this error:
Quote:

root@www:~# apache2ctl restart
[Sun Feb 04 15:02:00 2007] [warn] NameVirtualHost 192.168.1.4:0 has no VirtualHosts
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 *.
Quote:

NameVirtualHost x.gabrix.ath.cx
<VirtualHost x.gabrix.ath.cx>
Quote:

NameVirtualHost www.gabrix.ath.cx
<VirtualHost www.gabrix.ath.cx>
I get the error:
Quote:

root@www:~# apache2ctl restart
[Sun Feb 04 15:13:41 2007] [warn] NameVirtualHost x.gabrix.ath.cx:0 has no VirtualHosts

martinfst 4th February 2007 16:51

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.

gabrix 5th February 2007 02:59

What's that httpd -V it is apache2 in charge ....

martinfst 5th February 2007 09:37

Yes, and httpd is the name of the Apache(2) program actually running. You will see when you execute the command.


All times are GMT +2. The time now is 12:45.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.