Virtual Hosting Not Working

Discussion in 'Installation/Configuration' started by stirfry, Jun 13, 2007.

  1. stirfry

    stirfry New Member

    Yes, my server is hosted behind a router, and 209.40.195.6 is the external IP address.

    When I use the IP address (http://209.40.195.6/), I get the doc root of all sites, but when I go to http://www.sdellis.com, I get the "Shared IP" message. Also, my Vhost_ispconfig.conf IS included in the apache config file.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You must use the internal IP for the websites and not the external IP when your server is behind a router.
     
  3. stirfry

    stirfry New Member

    Till,
    I really appreciate your help, but I'm afraid I don't understand. I got three IP addresses with my Virtual Private Server plan with the understanding that I would need a unique IP for each site that needs its own SSL cert. Why would I only use one of these IPs with ISPConfig? Maybe I'm wrongly assuming these are external IPs? Here's the full output of ifconfig:

    Code:
    lo        Link encap:Local Loopback 
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
    
    venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
              inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.255
              UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
              RX packets:748595 errors:0 dropped:0 overruns:0 frame:0
              TX packets:821711 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:137913330 (131.5 MiB)  TX bytes:132132764 (126.0 MiB)
    
    venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
              inet addr:209.40.196.6  P-t-P:209.40.196.6  Bcast:0.0.0.0  Mask:255.255.255.255
              UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
    
    venet0:1  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
              inet addr:209.40.194.6  P-t-P:209.40.194.6  Bcast:0.0.0.0  Mask:255.255.255.255
              UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
    
    venet0:2  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
              inet addr:209.40.195.6  P-t-P:209.40.195.6  Bcast:0.0.0.0  Mask:255.255.255.255
              UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
     
  4. stirfry

    stirfry New Member

    Ok, I figured this out.

    I had to go into my /etc/apache2/vhosts/Vhosts_ispconfig.conf file and comment out the NameVirtualHost information for the IP addresses that I want to use SSL with. I guess ISPConfig assumes you want to used Name-based virtual hosts.

    Code:
    NameVirtualHost 209.40.194.6:80
    <VirtualHost 209.40.194.6:80>
      ServerName localhost
      ServerAdmin [email protected]
      DocumentRoot /var/www/sharedip
    </VirtualHost>
    #NameVirtualHost 209.40.195.6:80
    #<VirtualHost 209.40.195.6:80>
    #  ServerName localhost
    #  ServerAdmin [email protected]
    #  DocumentRoot /var/www/sharedip
    #</VirtualHost>
    I'm using name based vhosts on 209.40.194.6, but not on 209.40.195.6.
     
  5. ultraav

    ultraav New Member

    Hello guys,

    I am new to ispconfig and I have this annoying problem, which seems to be quite similar to the one discussed here. The difference is my web server uses a private ip address, as it is behind a firewall/router. So, even if the DocumentRoot of my www.domainname was set by ispconfig to /var/www/web6/web... httpd still uses /var/www/html as docroot when responding to requests for www.domainname

    Does anyone have a clue what is the proper way to configure when having the web server in a private net?

    /etc/hosts:
    Code:
    127.0.0.1               localhost.localdomain localhost
    192.168.1.10            servername.domainname servername
    
    Vhosts_ispconfig.conf:
    Code:
    ###################################
    #
    # ISPConfig vHost Configuration File
    #         Version 1.0
    #
    ###################################
    #
    NameVirtualHost externalip:80
    <VirtualHost externalip:80>
      ServerName localhost
      ServerAdmin [email protected]
      DocumentRoot /var/www/sharedip
    </VirtualHost>
    #
    #
    ######################################
    # Vhost: www.domainname:80
    ######################################
    #
    #
    <VirtualHost externalip:80>
    ServerName www.domainname:80
    ServerAdmin [email protected]
    DocumentRoot /var/www/web6/web
    ServerAlias domainname
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ErrorLog /var/www/web6/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php3>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php4>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php5>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode Off
    Alias /error/ "/var/www/web6/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /var/www/web6/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web6/user/$1/web/$3
    </VirtualHost>
    
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    You use the wrong IP address for the websites. You must use the internal and not the external IP address for the websites, when the server is behind a router.
     
  7. ultraav

    ultraav New Member

    yep, right on the target!

    Thank you very much, it works great now.
     

Share This Page