我使用nginx来对端口进行重定向:
代码如下:
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/conf.d/*******t.crt;
ssl_certificate_key /etc/nginx/conf.d/*******t.key;
ssl_session_timeout 5m;
#######
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
proxy_redirect 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;
proxy_pass http://127.0.0.1:8080;
}
}
保存后使用,nginx -t ,也无错误。
但是打开网站去看实际效果显示如图:
请问是那个地方出错了?
对了另外一个网站使用相同的命令却又成功了:
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/conf.d/********t.crt;
ssl_certificate_key /etc/nginx/conf.d/******net.key;
ssl_session_timeout 5m;
location / {
try_files $uri $uri/ =404;
proxy_redirect 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;
proxy_pass http://127.0.0.1:8080;
}
}
这个网站,使用同样的命令,却成功了。
求大佬解下惑。。。