Search code examples
apachevirtualhostlan

Apache virtualhost on another port


I have mamy virtualhosts on Apache server (Arch Linux) and they are on hosts like 127.0.0.2, 127.0.0.10 and so on. One of them i want to make available from local network, so I could use address like 192.168.1.100 to get resources from that server, but I don't want to use default port. Now I have such configuration on /etc/httpd/conf/extra/httpd-vhosts.conf

<VirtualHost 127.0.0.1:8324>
   DocumentRoot "/home/dominik/Dropbox/dev/SOMEAPP/root"
   <Directory /home/dominik/Dropbox/dev/SOMEAPP/root>
       DirectoryIndex index.php
       Options +Indexes +FollowSymLinks +MultiViews +Includes
       AllowOverride All
       Order allow,deny
       Allow from all
       Require all granted
   </Directory>
</VirtualHost>

It works perfect on local machine using localhost or 127.0.0.1, but when using lan address on port 8324, i get default apache site (like I make request on port 80)

curl 127.0.0.1:8324

HTML from SOMEAPP is returned

curl 192.168.1.100:8324

Default Apache index is returned

My /etc/hosts:

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost
#::1             localhost.localdomain   localhost
127.0.0.2       xx.tu                   xx.tu       
# 127.0.0.3     xxxxx.tu                xxxxx.tu       
127.0.0.4       xxxxxxxx.tu             xxxxxxxx.tu
127.0.0.5       xxxxxxxxxxx.tu           xxxxxxxxxxx.tu
127.0.0.6   xxxxx.tu        xxxxx.tu
127.0.0.10  xxxxxxx         xxxxxxxx

I'd be glad if someone have some idea. Thanks.


Solution

  • Probably a SuperUser question, anyway:

    <VirtualHost 192.168.1.100:8324>
       DocumentRoot "/home/dominik/Dropbox/dev/SOMEAPP/root"
       <Directory /home/dominik/Dropbox/dev/SOMEAPP/root>
           DirectoryIndex index.php
           Options +Indexes +FollowSymLinks +MultiViews +Includes
           AllowOverride All
           Order allow,deny
           Allow from all
           Require all granted
       </Directory>
    </VirtualHost>
    

    p.s. you might want to modify your httpd configuration to avoid receiving the default apache index when you call the apache server with an Ip which doesn't correspond to any defined virtualhost