解决nginx 报错提示:rewrite or internal redirection cycle while internally redirecting to “/“

之前的配置

server {
		listen 60088;
		server_name localhost;
		# 证书相关,https新增
		location / {
			root   html;
			index  index.html index.htm;
			try_files  $uri $uri/ D:/azpackage/nginx-1.20.2/html/oeos/index.html;
		}
		location /admin/ {
			proxy_pass http://localhost:60089/admin/;
		}
	}

修改后的配置

server {
		listen 60088;
		server_name localhost;
		# 证书相关,https新增
		location / {
			root   html;
			index  index.html index.htm;
			try_files  $uri $uri/ /oeos/index.html;
		}
		location /admin/ {
			proxy_pass http://localhost:60089/admin/;
		}
	}

主要问题就是try_files对应的配置,之前写的是绝对路径,但是前面root已经指定为html了,所以写绝对路径是访问不到的。

 这里修改为相对于html的路径地址就行了,简单说明下oeos是一个文件夹放在html下面。


版权声明:本文为qq_32406257原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。