nginx 修改非80端口
nginx默认监听80端口,但有些时候80端口要分配给其他应用的,所以要把nginx默认的80端口改掉,修改的文件位置在nginx安装目录下的conf文件下的nginx.conf。
nginx的默认配置为:
server { listen 80; server_name static.yisheng.com; location / { root D:/aaa; access_log off; #expires 1h; } }
换成监听81端口:
server { listen 81; server_name static.yisheng.com; location / { root D:/aaa; access_log off; #expires 1h; proxy_set_header Host $host:81; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; } }
代码中的红色标记了不同之处。
当然了,在项目使用的话要把http://static.yisheng.com换成带有端口的地址:http://static.yisheng.com:81
相关推荐
夜雨倚琴 2020-09-06
ljlxyf 2020-06-14
LiHansiyuan 2020-06-06
jackadmi 2020-05-07
Antech 2020-05-04
Vampor 2020-04-17
leodengzx 2020-04-16
xcznb 2020-01-06
LandryBean 2020-01-06
jmdvirus 2013-07-22
hithyc 2019-12-28
cheidou 2015-01-15
liuyanwuyu 2015-04-24
89421950 2015-08-03
在旅途 2019-11-08
xiongli 2015-05-18
royrui 2015-06-10
liweihui 2008-03-28