Nginx常用配置

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;
	
        # AI流式问答API代理
        location /cloudqa/ {
                proxy_buffering off;
                proxy_read_timeout 24h;
                proxy_connect_timeout 1h;
                proxy_http_version 1.1;
                proxy_cache off;
                keepalive_timeout 300;
                chunked_transfer_encoding on;
                tcp_nopush on;
                tcp_nodelay on;
                proxy_pass http://127.0.0.1:82;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
        }

        # 静态资源代理
        location / {
            root  'E:/cloud-qa-server/dist/';
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;
        }

        # 普通后台API代理
        location /101/ {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_pass http://127.0.0.1:81;
        }
    }
}

 

posted @ 2025-10-17 15:07  金元宝骑骑  阅读(5)  评论(0)    收藏  举报