简体   繁体   中英

Centos apache config

Hi I am trying to reach my centos Virtual machine which i created inside in a VMware vcenter using http://server-IP/ but couldn't have access using http. but i can access it using ssh. in the httpd.conf file i tried to change

"Listen 80" to Listen 8080 in the iptables also i have added the rule

**"-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT"**

But i still couldn't access it in my internet browser. need help to fix this . Thanks

Which version on CentOS exactly ?

What you could try, temporarily, is to disable iptables/firewalld (depending on your version), and see if you can access your website. If you can't, then at least you know it's not a firewall problem.

What is the port your apache listening, 80 or 8080? If you want to redirect 8080 to 80, use the following rule:

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

that will redirect all the traffic from 8080 to 80.

Can you run netstat -nltp and put here the output?

Try this:

iptables -A INPUT -p tcp --dport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp --sport 8080 -m state --state ESTABLISHED -j ACCEPT

Also make sure that the order of the rules is the right one. Sometimes there is a more restrictive rule after your rules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM