我在自己腾讯云服务器上更改nginx配置的操作指引
摘要:
1、我买的腾讯云服务器,是集成了nginx和mysql等环境的。
2、我需要调整nginx的配置,做我自己的站点指向
一、找到nginx的部署位置
which nginx
发现nginx在这里只是一个启动文件,我需要看看其运行配置
ps -ef | grep nginx
/www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
找到配置文件在
/www/server/nginx/conf/nginx.conf
拷贝nginx.conf文件到本地
"C:\Program Files\PuTTY\pscp.exe" -P 22 root@106.55.226.23:/www/server/nginx/conf/nginx.conf C:\Temps\t
我的初始站点:
http://106.55.226.23:8085/zx-tool-web/
访问验证地址:
http://106.55.226.23:8085/zx-tool-web/ctrl/tool/common/helloWorld
nginx配置期望的访问地址:
http://tool.p23.lookdaima.com:8086/ctrl/tool/common/helloWorld
相关配置:
server
{
listen 8086;
server_name tool.p23.lookdaima.com;
location / {
proxy_pass http://localhost:8085/zx-tool-web/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
在nginx.conf加上如上配置后,访问
cd /www/server/nginx/sbin/
重启nginx
./nginx -s reload
访问验证:
成功