最近我的nginx.conf文件在几台CentOS网络服务器上损坏了。我根据我的开发版本将它们重新组合在一起,但遇到一个问题,我得到一个“无法访问此站点”。每当我通过群集URL或HTTPS访问网站时都会收到消息。但是,当我直接使用机器的网络名称访问时,它工作正常。
这是我的nginx.conf文件的一个已清理版本...这里有什么东西可能会丢失吗?
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
# 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" "$ssl_client_s_dn" "$ssl_client_i_dn"';
access_log /var/log/nginx/access.log main;
sendfile off;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
location /DemoSite/signalr/Latest/ {
rewrite ^/DemoSite/Latest(.*)$ $1 break;
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location = /DemoSite/Latest {
return 302 /DemoSite/Latest/;
}
location /DemoSite/Latest/ {
root /var/www/DemoSite/Latest/wwwroot;
if ($query_string ~ "^([^&]*)_dc=([^&]*)$") {
rewrite ^(.*)$ $uri?;
}
try_files $uri @proxy_latest;
}
location @proxy_latest {
rewrite ^/DemoSite/Latest(.*)$ $1 break;
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location /DemoSite/signalr/1.0.0.0/ {
rewrite ^/DemoSite/1.0.0.0(.*)$ $1 break;
proxy_pass http://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location = /DemoSite/1.0.0.0 {
return 302 /DemoSite/1.0.0.0/;
}
location /DemoSite/1.0.0.0/ {
root /var/www/DemoSite/1.0.0.0/wwwroot;
if ($query_string ~ "^([^&]*)_dc=([^&]*)$") {
rewrite ^(.*)$ $uri?;
}
try_files $uri @proxy_1_0_0_0;
}
location @proxy_1_0_0_0 {
rewrite ^/DemoSite/1.0.0.0(.*)$ $1 break;
proxy_pass http://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location /DemoSite/signalr/3.0.2.0/ {
rewrite ^/DemoSite/3.0.2.0(.*)$ $1 break;
proxy_pass http://localhost:5002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location = /DemoSite/3.0.2.0 {
return 302 /DemoSite/3.0.2.0/;
}
location /DemoSite/3.0.2.0/ {
root /var/www/DemoSite/3.0.2.0/wwwroot;
if ($query_string ~ "^([^&]*)_dc=([^&]*)$") {
rewrite ^(.*)$ $uri?;
}
try_files $uri @proxy_3_0_2_0;
}
location @proxy_3_0_2_0 {
rewrite ^/DemoSite/3.0.2.0(.*)$ $1 break;
proxy_pass http://localhost:5002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
}
server {
listen 433 ssl http2 default_server;
location /DemoSite/Latest/signalr/ {
rewrite ^/DemoSite/Latest(.*)$ $1 break;
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-CERT-Subject $ssl_client_s_dn;
proxy_set_header X-CERT-Issuer $ssl_client_i_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location = /DemoSite/Latest {
return 302 /DemoSite/Latest/;
}
location /DemoSite/Latest/ {
root /var/www/DemoSite/Latest/wwwroot;
if ($query_string ~ "^([^&]*)_dc=([^&]*)$") {
rewrite ^(.*)$ $uri?;
}
try_files $uri @proxy_latest;
}
location @proxy_latest {
rewrite ^/DemoSite/Latest(.*)$ $1 break;
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-CERT-Subject $ssl_client_s_dn;
proxy_set_header X-CERT-Issuer $ssl_client_i_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location /DemoSite/1.0.0.0/signalr/ {
rewrite ^/DemoSite/1.0.0.0(.*)$ $1 break;
proxy_pass http://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-CERT-Subject $ssl_client_s_dn;
proxy_set_header X-CERT-Issuer $ssl_client_i_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location = /DemoSite/1.0.0.0 {
return 302 /DemoSite/1.0.0.0/;
}
location /DemoSite/1.0.0.0/ {
root /var/www/DemoSite/1.0.0.0/wwwroot;
if ($query_string ~ "^([^&]*)_dc=([^&]*)$") {
rewrite ^(.*)$ $uri?;
}
try_files $uri @proxy_1_0_0_0;
}
location @proxy_1_0_0_0 {
rewrite ^/DemoSite/1.0.0.0(.*)$ $1 break;
proxy_pass http://localhost:5001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-CERT-Subject $ssl_client_s_dn;
proxy_set_header X-CERT-Issuer $ssl_client_i_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location /DemoSite/3.0.2.0/signalr/ {
rewrite ^/DemoSite/3.0.2.0(.*)$ $1 break;
proxy_pass http://localhost:5002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-CERT-Subject $ssl_client_s_dn;
proxy_set_header X-CERT-Issuer $ssl_client_i_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
location = /DemoSite/3.0.2.0 {
return 302 /DemoSite/3.0.2.0/;
}
location /DemoSite/3.0.2.0/ {
root /var/www/DemoSite/3.0.2.0/wwwroot;
if ($query_string ~ "^([^&]*)_dc=([^&]*)$") {
rewrite ^(.*)$ $uri?;
}
try_files $uri @proxy_3_0_2_0;
}
location @proxy_3_0_2_0 {
rewrite ^/DemoSite/3.0.2.0(.*)$ $1 break;
proxy_pass http://localhost:5002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-CERT-Subject $ssl_client_s_dn;
proxy_set_header X-CERT-Issuer $ssl_client_i_dn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Path $request_uri;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Path $uri;
}
ssl on;
ssl_certificate "/etc/ssl/sewrver_certificate.cer";
ssl_certificate_key "/etc/ssl/server_certificate.key";
ssl_verify_client optional_no_ca;
}
}