技术解析
对 nginx 配置啥的不太熟悉。这几天在 vps 上搭了 frp,绑定了个域名给 frp 用。但是 frp 配置 vhost 的端口如果不是 80 的话,每次还得在域名后加端口或者再去 nginx 做转发。就想着把 80 端口给 frp 用,然后把 nginx 的默认监听改到 8080 之类的。
说干就干,先把 nginx 停了之后,把 fprs 配置文件中的 vhost 端口改为 80,然后重启 frp。实现了 frp 的所有 subdomain 能够直接通过类似 test.v2ex.com 直接访问,不用再加端口号。
然后就开始改 nginx 的配置: /www/server/nginx/conf/nginx.conf 将之前默认监听的 80 端口改为 8080 端口
server {
listen 8美国服务器080;
listen [::]:8080;
return 301 https://$host$request_uri;
}
重新启动 nginx,还是会提示 80 端口已经占用,就是现在没有读到修改后的配置,还是说我改的配置文件不对?
[[email protected]]# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
各位帮忙分析下问题的原因呗....多谢! Ps:nginx 是用宝塔面板直接装的。