nginx windows 代理 80端口 500

今天准备配置一个nginx 用来代理80端口分别访问.net core 和spring boot 服务器

配置使用的最基本的代理配置

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    server
    {
        listen 80;
        location /
        {
            proxy_pass   http://10.24.21.1:5001;
        }
    }
       
}

但是80端口始终返回500

查了好久没查到

最后看了个帖子:https://stackoverflow.com/questions/16021481/nginx-not-listening-to-port-80

试试把服务关掉 访问80 结果依然返回500

netstat -ano | findstr "80" 

发现巨多进程监听80端口

打开任务管理器一看

都是nginx.exe 才恍然大悟 最开始配置的时候把

worker_processes调成了1024 

默认双击nginx.exe nginx会后台运行
taskkill /f /im nginx.exe 

 杀掉所有进程后终于打开了页面

原文地址:https://www.cnblogs.com/wolbo/p/11477701.html