使用nginx作为后端统一路径的转发,未使用nginx代理的原先地址可以正常访问,使用nginx进行统一路径转发时,postman报了如下错误:

<html>

<head>
	<title>404 Not Found</title>
</head>

<body>
	<center>
		<h1>404 Not Found</h1>
	</center>
	<hr>
	<center>nginx/1.17.3</center>
</body>

</html>

造成这种404路径找不到的原因是nginx默认端口是80,而我本机的80端口已被占用,在nginx.conf文件中,将nginx默认的80端口修改为未被使用的端口即可!

      server {
        listen       81;        //------------------------------我这里是将原本默认的80端口改为了81,问题完美解决!
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐