因此,我设置了一个反向代理服务器,它对一个域名(webmin.norxxxxx.com)运行良好,但我还试图在域名 norwhales.com 上为另一个 IP 设置代理,但每次我去https://norxxxxxx.com(HTTP 尚未设置),它表现得像主机是 webmin.norxxxxxx.com。(我知道 SSL 证书,一旦修复了这个问题,它就会被修复。)这是我的配置:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include /usr/local/nginx/conf/mime.types;
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
server {
listen 91.134.231.xx:80;
server_name webmin.norxxxxx.com;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log ;
root /usr/share/nginx/html;
index index.html index.htm;
## send request back to apache1 ##
location / {
proxy_pass http://[2a06:e881:xxxx:xxx::1337];
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
## HTTPS
server {
listen 91.134.231.xx:443;
server_name webmin.norxxxxx.com;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log ;
root /usr/share/nginx/html;
index index.html index.htm;
ssl on;
ssl_certificate /etc/webmin/miniserv.cert;
ssl_certificate_key /etc/webmin/miniserv.pem;
## send request back to apache1 ##
location / {
proxy_pass https://[2a06:e881:xxxx:xxx::1337];
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}}
server {
listen 91.134.231.xx:443;
server_name norxxxxx.com;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log ;
root /usr/share/nginx/html;
index index.html index.htm;
ssl on;
ssl_certificate /etc/webmin/miniserv.cert;
ssl_certificate_key /etc/webmin/miniserv.pem;
location / {
proxy_pass https://[2a06:e881:xxxx:xxx::8];
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
##
}
#RTMP
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
}
}
}
答案1
解决了!
结果是 nginx 出了问题,重启服务器就解决了。我真傻,第一次没有尝试这个。