Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说nginx默认安装80端口修改,希望能够帮助你!!!。
nginx安装启动发现80默认端口冲突,一般是和tomcat服务冲突了。
所以在这里我们直接取修改nginx的默认端口。
通过whereis nginx我们知道了nginx的配置文件目录
在配置文件目录下的sites-available目录中我们找到了default文件,进行修改,修改前先备份。
vi进去后将80端口修改成8888端口号
修改后
重启nginx,启动后没有报错。
改对应映射nginx.conf配置文件后可以重新加载一下
nginx -s reload
参考:
You can run two server on the same port using nginx:
https://serverfault.com/questions/242679/how-to-run-multiple-nginx-instances-on-different-port
If you installed gitlab-omnibus and if you want to change the default port:
Open /etc/gitlab/gitlab.rb
Add external_url “http:// domain:NewPort”
Run gitlab-ctl reconfigure
If you have installed gitlab manually locate nginx’s folder (you can type whereis nginx on the console) and modify gitlab’s file on the sites-available subfolder. Normally the file you have to modify is: /etc/nginx/sites-available/gitlab
/etc/nginx/sites-available
其他报错
nginx重启报错:nginx: [error] invalid PID number “” in “/run/nginx.pid”
问题描述:执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错
nginx: [error] invalid PID number “” in “/run/nginx.pid”
解决办法
需要先执行
nginx -c /etc/nginx/nginx.conf
nginx.conf文件的路径可以从nginx -t的返回中找到。
nginx -s reload
今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
上一篇
已是最后文章
下一篇
已是最新文章