LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Forwarding domains rather than ports? (https://www.linuxquestions.org/questions/linux-newbie-8/forwarding-domains-rather-than-ports-164247/)

cquinn 03-30-2004 02:21 PM

Forwarding domains rather than ports?
 
I have been using a linux firewall box (from LRP) for years now, but I haven't *relly* learned linux. The one I have now is portfwarding stuff to internal machines fine.

Can anyone tell me if its possible to forward to internal machines based on the domain requested rather than the port? I am guessing that I would have to forward everything to an apache server, that would then find the files for the right domain using rewrite script (are these the right words?). I'd prefer to be able to do it all from the firewall though.

Cliff

Mara 03-30-2004 02:30 PM

With iptables is extremaly hard to do. It works using IP addresses and ports. Requests are made after domain names were resolved to IPs. That's why you'd need to filter by content of the packages (HTTP requests and so on).

tuxguy 03-31-2004 10:43 AM

for the forwarding of domains.. dont think the firewall can do it. Take a look at virtualhosts and NameVirtualHost in apache.

This will do it no problem.. you tell it that the host is on 192.168.1.2 and then the servername/alais would be.. www.site1.com.

ie.

NameVirtualHost 192.168.1.2
NameVirtualHost 192.168.1.3

<VirtualHost 192.168.1.2>
ServerAdmin you@email.com
DocumentRoot /path/to/documents
ServerName www.sitename.com
ServerAlias sitename.com
</VirtualHost>

<VirtualHost 192.168.1.3>
ServerAdmin you@email2.com
DocumentRoot /path/to/documents2
ServerName www.sitename2.com
ServerAlias sitename2.com
</VirtualHost>

This should work no problem... but if all the documents for the sites are on one server take out the IP address's (everywhere above) and replace with an * where the IP's are above. And you would only need one NameVirtualHost directive so comment out the second one.

good luck


All times are GMT -5. The time now is 11:15 AM.