建站时遇到的nginx端口冲突问题
温馨提示:
本文最后更新于 2024年08月01日,已超过 266 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我。
在搭建该博客时,使用了宝塔面板并安装了nginx导致nginx默认监听的80端口和博客前台的80端口冲突。当即决定修改nginx的默认端口,打开nginx的配置文件并没有发现80端口的监听,配置文件如下:
user www www;
worker_processes auto;
error_log /www/wwwlogs/nginx_error.log crit;
pid /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
stream {
log_format tcp_format '$time_local|$remote_addr|$protocol|$status|$bytes_sent|$bytes_received|$session_time|$upstream_addr|$upstream_bytes_sent|$upstream_bytes_received|$upstream_connect_time';
access_log /www/wwwlogs/tcp-access.log tcp_format;
error_log /www/wwwlogs/tcp-error.log;
include /www/server/panel/vhost/nginx/tcp/*.conf;
}
events
{
use epoll;
worker_connections 51200;
multi_accept on;
}
http
{
include mime.types;
#include luawaf.conf;
include proxy.conf;
default_type application/octet-stream;
server_names_hash_bucket_size 512;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/json image/jpeg image/gif image/png font/ttf font/otf image/svg+xml application/xml+rss text/x-js;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;
server_tokens off;
access_log off;
include /www/server/panel/vhost/nginx/*.conf;
}
虽然没有在这里面找到监听80端口的代码,但是看到有include所以便挨个打开查看。将所有引入的配置检查一遍后还是没能找到监听80端口的代码。然后想了想停止了博客的前台的运行再,再去访问80端口终于发现这个页面是宝塔的默认页面,由于是第一次使用宝塔面板不太了解宝塔的nginx配置在哪里所以使用了find / -name nginx*命令去寻找nginx相关的配置文件,终于在宝塔主程序目录下找到了phpfpm_status.conf这个配置文件,记录着宝塔面板监听nginx 80端口的代码,将这个端口修改后就大功告成。
正文到此结束
- 本文标签: Linux
- 本文链接: https://ssadan-blog.cn/article/3
- 版权声明: 本文由sadan原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权