我正在尝试设置Nginx服务器。我可以访问127.0.0.1:80
和localhost:80
上的内容,但不能访问我的公共IP(xxxx.xxxx.xxxx.xxxx
)上的内容。这是我的配置:
/etc/nginx.conf:
user rud;
worker_processes auto;
include /etc/nginx/modules-enabled/*.conf;
daemon off;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
types_hash_max_size 4096;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/ etc / nginx / sites-enabled / default:
server {
listen *:80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ =403;
}
}
我已经应用了一些从网络上获得的提示,例如将我的公共ip(xxxx.xxxx.xxxx.xxxx
)添加到default
的{{1}}文件中,但是仍然无法使用。
回答重复的问题https://superuser.com/q/841255/733877和https://serverfault.com/q/361499/476613无效。