#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 10m;
#access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
server {
listen 10004;
#listen 14430 ssl;
#server_name jsxjj.360logs.com;
#ssl_certificate 根路径/project/cxgx/config/nginx-1.16.1/cert/ssl.pem;
#ssl_certificate_key 根路径/project/cxgx/config/nginx-1.16.1/cert/ssl.key;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
#ssl_ciphers HIGH:!aNULL:!MD5;
#ssl_prefer_server_ciphers on;
#server_name yanqing.nxycsw.cn;
autoindex on;
#charset koi8-r;
#access_log logs/host.access.log main;
# static file cache
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
types {
text/html html htm shtml;
text/log log;
text/css css;
text/xml xml;
text/js js;
text/md md;
text/woff woff;
text/ttf ttf;
}
location / {
autoindex on;
alias 根路径/nginx-1.16.1/html/dist/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /node_modules {
autoindex on;
alias 根路径/nginx-1.16.1/html/node_modules/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /log {
autoindex on;
alias 根路径/cxgs_fastapi_base/logs/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
add_header Cache-Control no-store;
}
location /openapi.json {
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://127.0.0.1:30000/openapi.json;
}
location /docs {
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://127.0.0.1:30000;
}
location /redoc {
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://127.0.0.1:30000;
}
location /api {
proxy_pass http://127.0.0.1:30000/api;
}
location ~ ^/(baiduApi)/.* {
rewrite ^.+baiduApi/?(.*)$ /$1 break;
# include uwsgi_params;
root 根路径/nginx-1.16.1/html;
proxy_pass https://aip.baidubce.com;
# proxy_set_header Host $http_host;
}
}
}