Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache vhosts
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
TheRAt
Veteran
Veteran


Joined: 03 Jun 2002
Posts: 1580

PostPosted: Tue Mar 14, 2006 10:42 pm    Post subject: Apache vhosts Reply with quote

Sorry for the long post, but I thought to provide as much information on this as I could...

My Setup:

eth0 = realworld IP, attached to the internet: 222.154.XXX.XXX

eth1 = internal network only
eth1 = 192.168.1.1
eth1:0 = 192.168.1.2
eth1:1 = 192.168.1.3

I have apache configured with vhosts:

  • /etc/apache2/vhosts.d/00_default_vhost.conf
    Code:
    NameVirtualHost *:80
    <IfDefine DEFAULT_VHOST>
    <VirtualHost *:80>
        DocumentRoot "/var/www/localhost/htdocs"
        <Directory "/var/www/localhost/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
        <IfModule peruser.c>
            ServerEnvironment apache apache
            MinSpareProcessors 4
            MaxProcessors 20
        </IfModule>
    </VirtualHost>
    </IfDefine>


  • /etc/apache2/vhosts.d/01_titan.internaldomain.net_vhost.conf
    Code:
    NameVirtualHost 192.168.1.1:80
    <VirtualHost 192.168.1.1:80>
        ServerAdmin root@localhost
        DocumentRoot "/var/www/titan.internaldomain.net/htdocs"
        ScriptAlias /cgi-bin/ /var/www/titan.internaldomain.net/cgi-bin/
        ServerName titan
        ErrorLog logs/titan.internaldomain.net-error_log
        CustomLog logs/titan.internaldomain.net-access_log common

        <Directory "/var/www/titan.internaldomain.net/cgi-bin/">
            AllowOverride None
            Options None
            Order allow,deny
            Allow from all
        </Directory>
        <Directory "/www/docs/titan.internaldomain.net/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
        <Directory "/usr/portage">
            Options +Indexes +FollowSymLinks +Multiviews
            <IfModule mod_access.c>
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
                Allow from 192.168.1.0/24
            </IfModule>
        </Directory>
        <Location "/gentoo">
            Options +Indexes +FollowSymLinks +Multiviews
            <IfModule mod_access.c>
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
                Allow from 192.168.1.0/24
            </IfModule>
        </Location>
    </VirtualHost>


  • /etc/apache2/vhosts.d/02_deimos.mydomain.com_vhost.conf
    Code:
    NameVirtualHost 222.154.XXX.XXX:443
    <VirtualHost 222.154.XXX.XXX:443>
        ServerAdmin root@localhost
        DocumentRoot "/var/www/deimos.mydomain.com/htdocs"
        ServerName deimos.mydomain.com:443
        ErrorLog logs/deimos.mydomain.com-error_log
        CustomLog logs/deimos.mydomain.com-access_log common
        <IfModule mod_log_config.c>
            TransferLog logs/deimos.mydomain.com-transfer_log
        </IfModule>
        SSLEngine on
        SSLCertificateFile conf/ssl/deimos.mydomain.com.crt
        SSLCertificateKeyFile conf/ssl/deimos.mydomain.com.key
        <Files ~ "\.(cgi|shtml|phtml|php?)$">
            SSLOptions +StdEnvVars
        </Files>
        <Directory "/var/www/deimos.mydomain.com/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride AuthConfig
            Order allow,deny
            Allow from all
        </Directory>
        <Directory "/var/www/deimos.mydomain.com/cgi-bin/">
            AllowOverride None
            Options None
            Order allow,deny
            Allow from all
            SSLOptions +StdEnvVars
        </Directory>
    </VirtualHost>


  • /etc/apache2/vhosts.d/03_deimos.internaldomain.net_vhost.conf
    Code:
    NameVirtualHost 192.168.1.3:80
    <VirtualHost 192.168.1.3:80>
        ServerAdmin root@localhost
        DocumentRoot "/var/www/deimos.internaldomain.net/htdocs"
        ServerName deimos.internaldomain.net:80
        ErrorLog logs/deimos.internaldomain.net-error_log
        CustomLog logs/deimos.internaldomain.net-access_log common
        <IfModule mod_log_config.c>
            TransferLog logs/deimos.internaldomain.net-transfer_log
        </IfModule>
       
        <Directory "/var/www/deimos.mydomain.com/htdocs">
            Options Indexes FollowSymLinks
            AllowOverride AuthConfig
            Order allow,deny
            Allow from all
        </Directory>

        <Directory "/var/www/deimos.mydomain.com/cgi-bin/">
            AllowOverride None
            Options None
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>


This serves sites @: www.internaldomain.net, titan.internaldomain.net, deimos.mydomain.com which all work fine, and as expected..
I am trying to get the server to serve the deimos.mydomain.com site internally at deimos.internaldomain.net, but this is not working..
I do not see anything in the logs, and apache starts without any errors.. The browser gives: "Unable to connect Firefox can't establish a connection to the server at 192.168.1.3"

However, I am able to ping that address, and also the ssh daemon running on that IP address works as expected..

Any advice on how to fix this?
_________________
All reality is the construct of the observer.

Get Firefox and rediscover the web!

BOFH Excuse #295:
The Token fell out of the ring. Call us when you find it.
Back to top
View user's profile Send private message
gentoo_0x00
n00b
n00b


Joined: 10 Mar 2005
Posts: 21
Location: Portland, Oregon

PostPosted: Tue Mar 14, 2006 11:09 pm    Post subject: Reply with quote

Depending on how the rest of your config is setup (mostly /etc/conf.d/apache2 ) you may need to wrap those internal domains in a <IfDefine DEFAULT_VHOST> else apache will ignore them.

You could also use nmap to test to see if the ports are open.
_________________
What if there was no such thing as hypothetical questions?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum