LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   hot to allow website to passt hrough iptables (https://www.linuxquestions.org/questions/linux-newbie-8/hot-to-allow-website-to-passt-hrough-iptables-932203/)

mlnm 03-01-2012 12:20 PM

hot to allow website to passt hrough iptables
 
hi friends, i installed apache web server and a public wqebsite in it ,when iptables are on the website is not openig in wan,but after stopping iptables service it works find ,but i want to run websire with iptables how is ti possible.

MensaWater 03-01-2012 02:09 PM

Turn on iptables then run "iptables -nL" to see what you have. Iptables chains are vary by distribution.

Generally you simply have to add port 80 (for standard web traffic) and/or port 443 (for https traffic). Some web pages have special ports (which would show up in the URL like "www.mypage.com:3000" if it were port 3000 for example) so you'd have to open those if you had any.

So for example on a RHEL5 system one might add a rule to open port 80 in the RH-Firewall-1-INPUT chain with:
iptbales -A RH-Firewall-1-INPUT -p tcp -m state --state NEW,ESTABLISHED -m tcp --dport 80 -j ACCEPT

You'd make a similar rule for port 443 or other ports you needed. You can also restrict the ports to certain IPs or ranges.

Typing "man iptables" will give you more details. Note that after you add the rules you need to save the iptables (see iptables-save command) to whatever file is read at boot on your distro to be sure it re-adds the rules after a reboot.


All times are GMT -5. The time now is 12:46 PM.