可以wget站点,但不能外部访问

时间:2014-07-11 17:50:37

标签: apache jira iptables mod-proxy confluence

我正在尝试使用Apache 2作为反向代理在一台主机上设置Atlassian Confluence和JIRA。

当我这样做时

wget http://localhost:8080
--2014-07-11 17:40:41--  http://localhost:8080/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost:8080/secure/MyJiraHome.jspa [following]
--2014-07-11 17:40:41--  http://localhost:8080/secure/MyJiraHome.jspa
Reusing existing connection to localhost:8080.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost:8080/secure/Dashboard.jspa [following]
--2014-07-11 17:40:41--  http://localhost:8080/secure/Dashboard.jspa
Reusing existing connection to localhost:8080.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: âindex.html.7â

同样适用于:8090 - 它获取页面并下载它。此外,wget也可以从外部服务器正常工作。

但是,当尝试通过浏览器访问它们时,只有:使用IP时可以访问8090,并且其中任何一个都不能通过域名访问。

这是我的apache2.conf的相关部分:

ServerName conf.site.com
<VirtualHost *:80>
ServerName conf.site.com
ServerAlias conf

ProxyPreserveHost On
ProxyRequests Off

ProxyPass / `http://127.0.0.1:8090/`
ProxyPassReverse / `http://127.0.0.1:8090/`

   订单允许,拒绝    允许所有人        

   ServerName jira.site.com    ServerAlias jira

ProxyPreserveHost On   ProxyRequests关闭   ProxyPass / http://127.0.0.1:8080/   ProxyPassReverse / http://127.0.0.1:8080/

  订单允许,拒绝   允许所有人      

这是我的iptables(ufw被禁用)

iptables -L -v -n
Chain INPUT (policy ACCEPT 12963 packets, 1222K bytes)
pkts bytes target     prot opt in     out     source               destination
0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0             tcp dpt:8090
0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8080
0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80
33  3723 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8080
10   716 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80
38  3375 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8080
28  1969 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8080
8804  734K fail2ban-ssh  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 22
33 11768 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0             udp dpt:68

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 13032 packets, 1227K bytes)
pkts bytes target     prot opt in     out     source               destination

Chain fail2ban-ssh (1 references)
pkts bytes target     prot opt in     out     source               destination
8779  732K RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

此外,netstat -tulp显示80,8080和8090正在收听:

tcp6       0      0 [::]:http               [::]:*                  LISTEN      18312/apache2
tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN      4868/java
tcp6       0      0 [::]:8090               [::]:*                  LISTEN      3578/java

这对我来说似乎很奇怪,所以任何建议都会非常感激。

1 个答案:

答案 0 :(得分:1)

回过头来解决这个问题,但忘了发帖。问题是HTTP Proxy apache2模块由于某种原因没有打开。

  

a2enmod proxy_http

做了这个伎俩。