[users@httpd] Namebased Virtual Hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,

I'm having the honor to set up an environment where 3 different virtual hosts should be running on Apache 2.0.x, each listening on :80 and :443.

Operating system is Debian Sarge.

The problem: I'm just having ONE IP-adress. Since this is only a test- and development-server, I thought I'd  try the following trick:

- I updated the hosts from my Windows-machine with the host/IP-values: So far, so good, host-names get resolved.
- I updated /etc/hosts from my Debian-machine - fine, host-names get resolved.
- I updated ports.conf so that on both :80 and :443 there's a listener, however, a netstat -ln looks awkward to me:

Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:896             0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:113             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8787            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN
udp        0      0 0.0.0.0:68              0.0.0.0:*
udp        0      0 0.0.0.0:111             0.0.0.0:*
udp        0      0 0.0.0.0:890              0.0.0.0:*
udp        0      0 0.0.0.0:893             0.0.0.0:*

I can see that on both ports there's a listener, but why is it 0.0.0.0 instead of 127.0.0.1?

Anyhow, when I try to connect to either domain via :80 or :443 (ssl), I get a "404 Not found", and I'm pretty sure that this is caused by a flaw in my configs - but which one?

Below I'm posting my VirtualHosts-Def, maybe one of you could let me know where the flaw is:

(Yes, rights are ok, paths are there, I've double-check that over and over again).

Maybe one more interesting thing:

When restarting Apache2, I'm getting the following warning:

Starting web server: Apache2apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Tue Oct 17 17:01:32 2006] [warn] NameVirtualHost test-ltc:80 has no VirtualHosts
[Tue Oct 17 17:01:32 2006] [warn] NameVirtualHost test-ltc:443 has no VirtualHosts

sites-availabe/dom (yes, I did "a2ensite" for each site and retarted Apache after this):

NameVirtualHost test-dom:80
<VirtualHost test-dom:80>
        ServerAdmin webmaster@localhost
        ServerName test-dom
        # don't loose time with IP address lookups
        HostnameLookups Off
        # needed for named virtual hosts
         UseCanonicalName Off
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug
        ServerSignature Off
        CustomLog /var/log/apache2/dom_access.log combined
        ErrorLog /var/log/apache2/dom_error.log

        DocumentRoot /var/www/dom
        <Directory /var/www/dom>
                Options FollowSymLinks
                AllowOverride None
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order deny,allow
                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
        Deny from all
</Directory>

</VirtualHost>


sites-available/dom-ssl:

NameVirtualHost test-dom:443
<VirtualHost test-dom:443>
        ServerAdmin webmaster@localhost
        ServerName test-dom
        # don't loose time with IP address lookups
        HostnameLookups Off
        # needed for named virtual hosts
         UseCanonicalName Off

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug
        ServerSignature Off
        CustomLog /var/log/apache2/dom-ssl_access.log combined
        ErrorLog /var/log/apache2/dom-ssl_error.log

        # SSL
        SSLEngine On
        SSLCipherSuite HIGH:MEDIUM
        SSLCertificateFile    /etc/apache2/ssl/dom.crt
        SSLCertificateKeyFile /etc/apache2/ssl/dom.key

        DocumentRoot /var/www/ssl/dom
        <Directory /var/www/ssl/dom>
                Options FollowSymLinks
                AllowOverride None
                AuthName "DOM_Auth"
                AuthType Cookie
                CookieAuth on
                CookieAuth_DBhost localhost
                CookieAuth_DBName apacheSSO
                CookieAuth_DBtable inter_sessions
                CookieAuth_DBUser test
                CookieAuth_DBPassword test
                CookieAuth_UsernameField username
                CookieAuth_SessnameField sessname
                CookieAuth_SessvalField sesskey
                CookieAuth_CookieName JSESSIONIDSSO
                CookieAuth_ExpiryField expiry
#               CookieAuth_RemoteIPField remoteip
                CookieAuth_FailureURL /SingleSignOn
                require valid-user
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride None

                Order deny,allow
                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
        Deny from all
</Directory>

</VirtualHost>

The other files (site2, site2-ssl, site3, site3-ssl) pretty much look the same.

Any ideas?

Cheers

Greg
--
what's puzzlin' you, is the nature of my game
[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux