nginx修改配置文件不生效,启动跳错误页面的问题

问题描述

之前在使用nginx发现了一个很奇怪的问题,在配置了反向代理Tomcat服务器集群之后,想要再次修改配置文件来当一个简单的静态资源的服务器来使用,发现一直报错,就是nginx的错误页面,反复检查了配置文件都没有发现问题,非常的奇怪,最骚的是浏览器错误页面窗口的小图标是tomcat,就是下面这样
错误页面的小图标
当然标题不是Tomcat,但是图标却是Tomact,这让我是头皮发麻,为啥呢到底?早就把代理Tomcat服务器的配置给删了,nginx也重启了,怎么还有Tomcat呢?看了看日志信息,发现他还再找之前配置的tomcat服务器

connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8082/", host: "localhost"
 [error] 18336#21140: *70 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8083/", host: "localhost"
 [error] 18336#21140: *70 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "localhost"
 [error] 18336#21140: *70 no live upstreams while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://nginxCluster/favicon.ico", host: "localhost", referrer: "http://localhost/"
 [error] 12984#6600: *1 CreateFile() "D:\nginx-1.17.2/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1", referrer: "http://127.0.0.1/"

明明配置文件已经改了,为啥还找以前的版本呢?
后来才发现是ngnix的后台进程没有关干净,仍然是之前的进程在跑,也许之前的进程一直有之前配置文件的信息吧

解决方案

在ngnix的bin目录下cmd控制台输入

taskkill /IM  nginx.exe  /F

关闭所有的ngnix进程,或者打开电脑的资源管理器一个个关也可以
然后重启nginx服务器,就ok!

你可能感兴趣的:(nginx修改配置文件不生效,启动跳错误页面的问题)