Results 1 to 7 of 7

Thread: apache2 local subdomain and external server

  1. #1
    Join Date
    Jun 2006
    Location
    Near Toronto Ontario
    Beans
    604
    Distro
    Ubuntu 9.10 Karmic Koala

    apache2 local subdomain and external server

    Hi all, I am looking to host a pos system internally on my LAN but also want to host a website; both on different ports. My external ip is updated by ddns by my roughter running dd-wrt (to host: rekahsoft.homelinux.org). I want to accept connections on port 80 for this site and then have a pos system accessible over my network on port 8080 (i have dhcp reserves on my roughter for my server so it has static ip). What would my /etc/apache2/httpd.conf look like? This was what i was trying but it didn't seem to work
    Code:
    Listen 80
    Listen 8080
    
    NameVirtualHost localhost:80
    NameVirtualHost localhost:8080
    
    <VirtualHost localhost:80>
         ServerName rekahsoft.homelinux.org
         DocumentRoot /var/www
    </VirtualHost>
    
    <VirtualHost localhost:8080>
         ServerName pos.rekahsoft.local
         DocumentRoot /var/www/pos
    </VirtualHost>
    Thanks everyone
    Last edited by rekahsoft; December 14th, 2009 at 05:25 AM. Reason: add a friendly ending
    Visit my Blog at http://rekahsoft.org

  2. #2
    Join Date
    Sep 2008
    Location
    CyberSpace
    Beans
    240
    Distro
    Kubuntu 22.10 Kinetic Kudu

    Re: apache2 local subdomain and external server

    Quote Originally Posted by rekahsoft View Post
    Hi all, I am looking to host a pos system internally on my LAN but also want to host a website; both on different ports. My external ip is updated by ddns by my roughter running dd-wrt (to host: rekahsoft.homelinux.org). I want to accept connections on port 80 for this site and then have a pos system accessible over my network on port 8080 (i have dhcp reserves on my roughter for my server so it has static ip). What would my /etc/apache2/httpd.conf look like? This was what i was trying but it didn't seem to work
    Code:
    Listen 80
    Listen 8080
    
    NameVirtualHost localhost:80
    NameVirtualHost localhost:8080
    
    <VirtualHost localhost:80>
         ServerName rekahsoft.homelinux.org
         DocumentRoot /var/www
    </VirtualHost>
    
    <VirtualHost localhost:8080>
         ServerName pos.rekahsoft.local
         DocumentRoot /var/www/pos
    </VirtualHost>
    Thanks everyone
    Its because you have it in the wrong, it has to be in order. You can't do it like that. Plus you don't need the "Listen *" statements if you are doing a virtual host.

    It should look like this:

    Code:
    NameVirtualHost localhost:80
    
    <VirtualHost localhost:80>
         ServerName rekahsoft.homelinux.org
         DocumentRoot /var/www
    </VirtualHost>
    
    NameVirtualHost localhost:8080
    
    <VirtualHost localhost:8080>
         ServerName pos.rekahsoft.local
         DocumentRoot /var/www/pos
    </VirtualHost>
    Also you need at least one Directory statement. Like this:

    Code:
    <Directory /var/www/>
    		Options FollowSymLinks MultiViews
    		AllowOverride None
    		Order allow,deny
    		Allow from all
    	</Directory>
    I am now back to help the Proton Gaming phase!
    OS: Kubuntu 22.10

  3. #3
    Join Date
    Jun 2006
    Location
    Near Toronto Ontario
    Beans
    604
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: apache2 local subdomain and external server

    Alright so everything works except for accessing the LAN only sub-domain..(by going to pos.rekahsoft.local but i can access the restricted directory from rekahsoft.local/pos..here is my httpd.conf:
    Code:
    NameVirtualHost localhost:80
    
    <Directory /var/www>
         Options FollowSymLinks MultiViews
         AllowOverride None
         Order allow,deny
         Allow from all
    </Directory>
    
    <VirtualHost localhost:80>
         ServerName rekahsoft.homelinux.org
         DocumentRoot /var/www
    </VirtualHost>
    
    NameVirtualHost localhost:8080
    
    <Directory /var/www/pos>
         Options FollowSymLinks MultiViews
         AllowOverride None
         Order deny,allow
         Allow from 192.168.1.100
         Deny from all
    </Directory>
    
    <VirtualHost localhost:8080>
         ServerName pos.rekahsoft.local
         DocumentRoot /var/www/pos
    </VirtualHost>
    What do i need to do to make the local subdomain work (eg. pos.rekahsoft.local)
    Visit my Blog at http://rekahsoft.org

  4. #4
    Join Date
    Jun 2006
    Location
    Near Toronto Ontario
    Beans
    604
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: apache2 local subdomain and external server

    Also how would i restrict the directory /var/ww/pos to the ip range 192.168.1.100-192.168.1.111?
    Visit my Blog at http://rekahsoft.org

  5. #5
    Join Date
    Jun 2006
    Location
    Near Toronto Ontario
    Beans
    604
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: apache2 local subdomain and external server

    Anyone?
    Visit my Blog at http://rekahsoft.org

  6. #6
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

  7. #7
    Join Date
    Apr 2008
    Location
    Far, far away
    Beans
    2,148
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: subnet mask

    You need to add the local subdomain to your router DNS. DD-WRT runs dnsmasq for this so just add correct entry there. Rigth now your subdomain isn't getting resolved to the correct local IP.

    You won't need to block IPs for that subdomain - just make sure that your router does not forward for port 8080 so that public users cannot get to that port anyway.

    Your order directive for pos doesn't make sense either. You should use,

    Order allow,deny
    Allow from 192.168.1.100/28

    This gives you 4 bits open = 16 ip block from .96 to .112
    If you need to really open only 100 to 111 then you may have to list them one by one as the notation only support block of binary multiples.

    The "order allow,deny" means match allows first, denys second and deny by default. Your ip range will match and be allowed, all else denied.
    Last edited by BkkBonanza; December 19th, 2009 at 11:06 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •