解决Nginx占用80端口问题
问题描述:
nginx 配置使用80端口,自动跳转到欢迎页面(welcome to nginx!),但是其他端口可以正常使用
解决方法:
配置文件目录:
/etc/nginx/sites-enables/
在这个目录下面除了在自己写的配置文件(×××.conf)外还有一个default文件,这个文件是默认加载的而配置文件,编辑这个default文件,打开以后是这样的:
编辑default中的80端口,将其改为其他不经常用的端口。最后重启nginx,nginx -s reload 即可
nginx重定向与端口映射,反向代理,外网访问内网问题

server { listen 80; access_log /var/log/nginx/statistics_cwtc_access.log; client_max_body_size 4G; fastcgi_buffers 64 8K; client_body_buffer_size 1024k; keepalive_timeout 5; client_body_timeout 15; client_header_timeout 15; send_timeout 15; sendfile on; tcp_nopush on; tcp_nodelay on; location ~ ^/(docs|uploads|service|bms_backend|manage|system|accounts|wechat) { include uwsgi_params; uwsgi_pass uwsgi://127.0.0.1:18567; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /bms-api/ { rewrite ^/bms-api/(.*) /$1 break; include uwsgi_params; uwsgi_pass uwsgi://127.0.0.1:18567; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~ ^/dashboard(/.*) { root /srv/lr-guomao/guomao_fe/dist; try_files $1 /index.html =404; } location ~ ^/wx(/.*) { root /srv/lr-guomao/guomao_fe/dist; try_files $1 /index.html =404; } location / { # rewrite ^/$ http://www.baidu.com redirect; # include uwsgi_params; # uwsgi_pass uwsgi://127.0.0.1:18567; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://172.16.35.253:8080; } }
I can feel you forgetting me。。 有一种默契叫做我不理你,你就不理我
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
2019-03-02 Scrapy-redis
2019-03-02 信号
2019-03-02 Scrapy的补充