简体   繁体   English

Centos apache 配置

[英]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.嗨,我正在尝试访问我在 VMware vCenter 中使用http://server-IP/创建的 centos 虚拟机,但无法使用 http 访问。 but i can access it using ssh.但我可以使用 ssh 访问它。 in the httpd.conf file i tried to changehttpd.conf文件中我试图改变

"Listen 80" to Listen 8080 in the iptables also i have added the rule在iptables中“听80”到听8080我也添加了规则

**"-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 ? CentOS 上到底是哪个版本?

What you could try, temporarily, is to disable iptables/firewalld (depending on your version), and see if you can access your website.您可以暂时尝试禁用 iptables/firewalld(取决于您的版本),然后查看您是否可以访问您的网站。 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?你的 apache 监听的端口是 80 还是 8080? If you want to redirect 8080 to 80, use the following rule:如果要将 8080 重定向到 80,请使用以下规则:

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

that will redirect all the traffic from 8080 to 80.这会将所有流量从 8080 重定向到 80。

Can you run netstat -nltp and put here the output?您可以运行netstat -nltp并将输出放在这里吗?

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.有时,在您的规则之后还有更严格的规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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