以下是我的设置的 nginx.conf 文件
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
upstream 135.250.138.150 {
server 135.250.138.74:8666;
server 135.250.138.75:8666;
keepalive 50;
# check interval=3000 rise=2 fall=2 timeout=1000 type=http;
}
server {
# listen 80 default_server;
# listen [::]:80 default_server;
listen 80;
# server_name www.server.com;
server_name _;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://135.250.138.150;
proxy_set_header Connection "";
proxy_http_version 1.1;
}
location /status {
proxy_pass http://135.250.138.150;
check_status;
}
}
server {
#Start
#Added After SSL certification created
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;
root /usr/share/nginx/html;
keepalive_timeout 100s;
ssl_certificate /etc/nginx/ssl/tls.crt;
ssl_certificate_key /etc/nginx/ssl/tls.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
include /etc/nginx/default.d/*.conf;
location /auth {
proxy_pass https://135.250.138.150;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location /status {
proxy_pass http://135.250.138.150;
check_status;
}
}
}
以下是文件中有关错误的日志详细信息/var/log/nginx/error.log
2018/01/04 13:30:28 [错误] 471#471:* 47 http上游检查模块找不到任何检查服务器,请确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP / 1.1”,主机:“135.250.138.150” 2018/01/04 13:30:30 [错误] 471#471:* 48 open()“ / usr / share / nginx / html / status”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:localhost,请求:“GET /status HTTP / 1.1”,主机:“135.250.138.150” 2018/01/04 13:30:31 [错误] 471#471:*48 open()“/usr/share/nginx/html/favicon.ico”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:localhost,请求:“GET /favicon.ico HTTP/1.1”,主机:“135.250.138.150”,引荐来源:“http://135.250.138.150/状态“ 2018/01/04 13:31:09 [错误] 471#471:*48 open()“ / usr / share / nginx / html / check_status”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:localhost,请求:“GET / check_status HTTP / 1.1”,主机:“135.250.138.150” 2018/01/04 13:31:18 [错误] 471#471:*50 open()“ / usr / share / nginx / html / check_status”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:_,请求:“GET / check_status HTTP / 1.1”,主机:“135.250.138.150” 2018/01/04 13:31:18 [错误] 471#471:*50 open()“ /usr/share/nginx/html/404.html”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:_,请求:“GET /check_status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:31:24 [错误] 471#471:*50 http上游检查模块找不到任何检查服务器,请确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:39:38 [错误] 471#471:*52 http上游检查模块找不到任何检查服务器,请确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP / 1.1”,主机:“135.250.138.150” 2018/01/04 13:39:45 [错误] 471#471:*54 open()“ /usr/share/nginx/html/check_status”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:localhost,请求:“GET /check_status HTTP / 1.1”,主机:“135.250.138.150” 2018/01/04 13:39:50 [错误] 471#471:*54 open()“/usr/share/nginx/html/status”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:localhost,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:39:57 [错误] 471#471:*56 http 上游检查模块找不到任何检查服务器,请确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:42:13 [错误] 1355#1355:*2 http 上游检查模块找不到任何检查服务器,确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:42:20 [错误] 1355#1355:*3 open()“ / usr / share / nginx / html / status”失败(2:没有此文件或目录),客户端:10.143.80.228,服务器:localhost,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:43:19 [错误] 1419#1419:*1 open()“ / usr / share / nginx / html / status”失败(2:没有此文件或目录),客户端: 10.143.80.228,服务器:localhost,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:43:26 [错误] 1419#1419:*3 http 上游检查模块找不到任何检查服务器,确保您已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:43:27 [错误] 1419#1419:* 6 http上游检查模块找不到任何检查服务器,请确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:46:30 [错误] 1567#1567:* 1 open()“/usr/share/nginx/html/status”失败(2:没有此文件或目录),客户端: 10.143.80.228,服务器:localhost,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150” 2018/01/04 13:46:40 [错误] 1567#1567:*4 http 上游检查模块找不到任何检查服务器,请确保已添加检查服务器,客户端:10.143.80.228,服务器:_,请求:“GET /status HTTP/1.1”,主机:“135.250.138.150”