操作系统:Funtoo。我已经将NGINX绑定到端口81(为了方便过渡,我想在我的Apache服务器上短时间运行它),并且它侦听该端口(如果我使用wget指向另一个端口,则会收到“拒绝连接”,但是使用端口81可以实现“连接”),但是它永远不会提供任何HTML响应!
在本地主机上的端口上运行wget时,我得到:
# wget localhost:81
-2014-04-16 23:56:45- http://localhost:81/
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:81... connected.
HTTP request sent, awaiting response...
在另一台计算机上...
$ wget 192.168.18.42:81
-2014-04-16 23:57:19- http://192.168.18.42:81/
Connecting to 192.168.18.42:81... connected.
HTTP request sent, awaiting response...
在那之后什么都没有发生。这些文档存在,它是正常的Funtoo nginx.conf。
更新:我可以让它监听端口80,但仍然令我感到困惑,因为我无法在任何端口上使用它。
netstat -aWn | grep 81 | grep LISTEN
tcp 60 0 0.0.0.0:81 0.0.0.0:* LISTEN
编辑:配置文件:
user nginx nginx;
worker_rlimit_nofile 6400;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
# This causes files with an unknown MIME type to trigger a download action in the browser:
default_type application/octet-stream;
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
client_max_body_size 64m;
# Don't follow symlink if the symlink's owner is not the target owner.
disable_symlinks if_not_owner;
server_tokens off;
ignore_invalid_headers on;
gzip off;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js image/x-icon image/bmp;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
index index.html;
include /etc/nginx/sites-enabled/*;
}
服务器块:
server {
listen *:81;
root /usr/share/nginx/html;
location / {
index index.html;
}
}
iptables未启用。
—
Aviator45003 2014年
我想,然后配置的相关部分会有所帮助。
—
Andreas Wiese 2014年
iptables
)?如果是这样,您还记得允许端口81吗?