Nginx听不同的端口,但不能从外部访问

操作系统:Ubuntu 12.04

我有Apache和Nginx运行。 Apache正在监听端口80,这就是为什么我要让Nginx监听不同的端口,在这个例子中,它将是90。

下面是/etc/nginx/sites-available/example.com上的configuration(是的,创build了符号链接):

 server { listen 90 default_server; server_name www.example.com.pl; root /var/www/example.com; index index.html index.htm; location / { try_files $uri $uri/ /index.html; } } 

我configuration了防火墙, ufw status显示:

 To Action From -- ------ ---- 90 ALLOW Anywhere ... 

我也添加了规则到iptables:

 Chain INPUT (policy DROP) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:90 ... 

nmap 12.34.567.89显示:

 Nmap scan report for www.example.com.pl (12.34.567.89) Host is up (0.00046s latency). Not shown: 991 closed ports PORT STATE SERVICE 25/tcp open smtp 80/tcp open http 90/tcp open dnsix ... 

以下是netstat -tulpn的输出:

 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:90 0.0.0.0:* LISTEN 26902/nginx ... 

index.html包含<h1> Nginx TEST </h1> ,当我从服务器执行wget www.example.com.pl:90 ,我下载文件没有任何问题。 但是,当我尝试从本地计算机telnet URL时,无法连接。 当我在浏览器中inputwww.example.com.pl:90时,显示ERR_CONNECTION_TIMED_OUT 。 一切都表明端口90closures到外部连接。 这就是我迷路的地方。 任何想法或build议?

PS。 请原谅,这是我的第一篇文章:)