Linux Nginx错误日志
我有一个数字海洋液滴,其中包含我的Meteor应用程序,但我在我的/var/log/nginx日志中不断发现这个错误: 2015/03/11 12:58:46[错误]21140:*423/usr/share/nginx/www/index.html未找到2:没有此类文件或目录,客户端:199.223.125.109,服务器:nickeleres.com,请求$ 我的申请不需要进入点;除此之外,我不知道这个指令在我的配置中来自哪里。我遵循这个指南: 我甚至从/etc/nginx/sites available/nickeleres中注释了这些行: 有人能给我指出正确的方向吗 编辑我的nginx配置Linux Nginx错误日志,linux,ubuntu,nginx,digital-ocean,Linux,Ubuntu,Nginx,Digital Ocean,我有一个数字海洋液滴,其中包含我的Meteor应用程序,但我在我的/var/log/nginx日志中不断发现这个错误: 2015/03/11 12:58:46[错误]21140:*423/usr/share/nginx/www/index.html未找到2:没有此类文件或目录,客户端:199.223.125.109,服务器:nickeleres.com,请求$ 我的申请不需要进入点;除此之外,我不知道这个指令在我的配置中来自哪里。我遵循这个指南: 我甚至从/etc/nginx/sites ava
server_tokens off; # for security-by-obscurity: stop displaying nginx version
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80 default_server; # if this is not a default server, remove "default_server"
listen [::]:80 default_server ipv6only=on;
#root /home/nickeleres; # root is irrelevant
#index /home/nickeleres; # this is also irrelevant
server_name nickeleres.com; # the domain on which we want to host the application. Since we set "default_server" previously, nginx will answer all hosts anyway.
# redirect non-SSL to SSL
location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
}
# HTTPS server
server {
listen 443 ssl spdy; # we enable SPDY here
server_name nickeleres.com; # this domain must match Common Name (CN) in the SSL certificate
#root /home/nickeleres; # irrelevant
#index /home/nickeleres; # irrelevant
ssl_certificate /etc/nginx/ssl/nickeleres.pem; # full path to SSL certificate and CA certificate concatenated together
ssl_certificate_key /etc/nginx/ssl/nickeleres.key; # full path to SSL key
# performance enhancement for SSL
ssl_stapling on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
# safety enhancement to SSL: make sure we actually use a safe cipher
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-E$
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000;";
# If your application is not compatible with IE <= 10, this will redirect visitors to a page advising a browser update
# This works because IE 11 does not present itself as MSIE anymore
if ($http_user_agent ~ "MSIE" ) {
return 303 https://browser-update.org/update.html;
}
# pass all requests to Meteor
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
# this setting allows the browser to cache the application in a way compatible with Meteor
# on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
# the root path (/) MUST NOT be cached
if ($uri != '/') {
expires 30d;
}
}
/usr/share/nginx/www/index.html是nginx在/etc/nginx/sites enabled/中显示的默认符号链接 Nginx加载/etc/Nginx/sites enabled/中的所有配置文件,这使得在同一台服务器上为不同的站点配置变得很容易。通常的方法是将这些配置文件存储在/etc/nginx/sites available/中,并在/etc/nginx/sites enabled/中添加要加载的配置文件的符号链接。默认情况下,在/etc/nginx/sites available/中有一个名为default的文件,在/etc/nginx/sites enabled/中有一个指向该文件的符号链接,因此未配置的服务器将显示默认的nginx index.html
删除/etc/nginx/sites enabled/default将删除符号链接,同时保留实际的配置文件,以备以后需要,防止nginx尝试加载/usr/share/nginx/www/index.html,我猜您已经删除了该文件。在原始帖子中添加了什么是浏览器请求URL?/etc/nginx/sites enabled/default仍然存在吗?如果不使用它,请记住删除它,否则您可能会有冲突的指令。
server_tokens off; # for security-by-obscurity: stop displaying nginx version
# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80 default_server; # if this is not a default server, remove "default_server"
listen [::]:80 default_server ipv6only=on;
#root /home/nickeleres; # root is irrelevant
#index /home/nickeleres; # this is also irrelevant
server_name nickeleres.com; # the domain on which we want to host the application. Since we set "default_server" previously, nginx will answer all hosts anyway.
# redirect non-SSL to SSL
location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
}
# HTTPS server
server {
listen 443 ssl spdy; # we enable SPDY here
server_name nickeleres.com; # this domain must match Common Name (CN) in the SSL certificate
#root /home/nickeleres; # irrelevant
#index /home/nickeleres; # irrelevant
ssl_certificate /etc/nginx/ssl/nickeleres.pem; # full path to SSL certificate and CA certificate concatenated together
ssl_certificate_key /etc/nginx/ssl/nickeleres.key; # full path to SSL key
# performance enhancement for SSL
ssl_stapling on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
# safety enhancement to SSL: make sure we actually use a safe cipher
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-E$
# config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
# to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping
add_header Strict-Transport-Security "max-age=31536000;";
# If your application is not compatible with IE <= 10, this will redirect visitors to a page advising a browser update
# This works because IE 11 does not present itself as MSIE anymore
if ($http_user_agent ~ "MSIE" ) {
return 303 https://browser-update.org/update.html;
}
# pass all requests to Meteor
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
# this setting allows the browser to cache the application in a way compatible with Meteor
# on every applicaiton update the name of CSS and JS file is different, so they can be cache infinitely (here: 30 days)
# the root path (/) MUST NOT be cached
if ($uri != '/') {
expires 30d;
}
}