Virtual host in different port static IP

Discussion in 'Apache' started by flope, Aug 17, 2010.

  1. #1
    Hi all,
    I have a web page being served from an static IP ('myip'). it can be accessed externally.
    I am creating a new web page and I want to serve it from the same computer/server but from different document root and with different log files.

    My apache is Apache/2.2.11 (Unix).

    I though that a solution would be using virtual hosting with different port numbers for each web.
    So, I added to httpd.conf the following:
    Include conf/extra/httpd-vhosts.conf

    and I added to httpd-vhosts.conf the following:
    
    Listen 8090
    
    NameVirtualHost 'myip':80
    NameVirtualHost 'myip':8090
    
    #Folder permision
    <Directory /usr/local/apache2/htdocs/newfolder>
              Order Deny,Allow
              Allow from all
     </Directory>
    
    <VirtualHost 'myip':80>
            DocumentRoot "/Library/WebServer/oldfolder"
            ServerName oldpage
    </VirtualHost>
    
    <VirtualHost 'myip':8090>
            DocumentRoot "/usr/local/apache2/htdocs/newfolder"
            ServerName newpage
    </VirtualHost>
    
    
    Code (markup):
    I restarted apache and the old page works when I use the 'myip' but the new one doesn't when I use 'myip':8090.

    Any suggestion? any different strategy that allows me to serve a second webpage without disturbing the structure of the first one will be really appreciated too.

    Thanks for your time and help,
    F
     
    flope, Aug 17, 2010 IP
  2. MrYu

    MrYu Peon

    Messages:
    157
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Assuimng 'oldpage' and 'newpage' refer to two different hostnames that resolve into the the same IP address, you should use the names, not IPs -- remember, you are using name-based virtual hosts.

    Also, the Listen directive should be "Listen 80,8090" to tell the server to listen on both ports.
     
    MrYu, Aug 18, 2010 IP
  3. flope

    flope Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi thanks for the fast reply!
    I had the "Listen 80" in the httpd.conf file.
    And actually, what I did works but I didn't realize.....
    Silly me, I assume that it would read the index.html by default but not.
    So, to make it work I had to indicate 'myip':8090/index.html.
    Well, this is easier to solve.
     
    flope, Aug 27, 2010 IP