nginx配置域名访问时域名后出现两个//
nginx配置域名访问时域名后出现两个//
server {
listen 80;
server_name wx.pyxrsj.cn;
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://localhost:8080/pyrsfw/; ####这个/一定要加上
index index.html index.htm index.jsp;
}
location ^~/wxapi/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8888/; ####这个/一定要加上
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /500.html {
}
}
listen 80;
server_name wx.pyxrsj.cn;
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://localhost:8080/pyrsfw/; ####这个/一定要加上
index index.html index.htm index.jsp;
}
location ^~/wxapi/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8888/; ####这个/一定要加上
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /500.html {
}
}
最近这两天重新写了一下我的个人网站,在阿里云新买了一台服务器,配置好以后出现了一个问题,就是输入域名后域名地址会自动在后面追加两个斜杆

并且网站还访问不了,仔细观察nginx配置后发现发现如下

解决办法
我们应该在nginx配置的路径后面加一个/

配置完成后
保存重启
再次访问 就没有问题了

相关推荐
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10
windle 2020-10-29