错误日志配置文件

访问日志文件

2023/10/15 07:13:48 [error] 30#30: *1 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 123.55.159.97, server: server_name, request: "GET / HTTP/1.1", host: "xxx.xxx.xxx.xxx"
123.55.159.97 - - [15/Oct/2023:07:13:48 +0000] "GET / HTTP/1.1" 500 579 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.46"
123.55.159.97 - - [15/Oct/2023:07:13:48 +0000] "GET /favicon.ico HTTP/1.1" 500 579 "http:///" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.46"
2023/10/15 07:13:48 [error] 30#30: *2 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 123.55.159.97, server: server_name, request: "GET /favicon.ico HTTP/1.1", host: "xxx.xxx.xxx.xxx", referrer: "http://xxx.xxx.xxx.xxx/"

nginx.conf配置文件内容

events {
	worker_connections  1024;
}

http {
include       mime.types;
default_type  application/octet-stream;
sendfile        on;
keepalive_timeout  65;

client_max_body_size     50m;
client_body_buffer_size  10m; 
client_header_timeout    1m;
client_body_timeout      1m;

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_comp_level  4;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
server {
listen       80;
server_name  my_server_name;

    location / {		
        root   /usr/local/xxx_vue;
        index  index.html index.htm; 
        try_files $uri $uri/ /index.html;	
    }
		
location ^~ /api/ {		
        proxy_pass http://xxx.xxx.xxx.xxx:8080/;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;						
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
	
}
}

问题分析

server {
    listen 80;
    server_name my_server_name;

    location / {
        root /usr/local/xxx_vue;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;
    }

    location = /index.html {
        root /usr/local/xxx_vue;
    }

    location ^~ /api/ {
        proxy_pass http://xxx.xxx.xxx.xxx:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

原文地址:https://blog.csdn.net/yang2330648064/article/details/133918519

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若转载,请注明出处:http://www.7code.cn/show_7827.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注