#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;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream WebServer {
#ip_hash;
server 172.18.0.1:8021;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /api {
proxy_pass http://WebServer;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Remote-Addr $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ws {
proxy_pass http://172.18.0.1:8021/ws/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ^~ /img/ {
expires 24h; #客户端缓存上述静态数据
root /usr/local/webserver/nginx/html; #文件路径
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
proxy_temp_path /usr/local/webserver/nginx/html;#文件路径
proxy_redirect off;
}
location ^~ /Data/ {
expires 24h; #客户端缓存上述静态数据
root /usr/local/wwwroot/zndb/wwwroot; #文件路径
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
proxy_temp_path /usr/local/wwwroot/zndb/wwwroot;#文件路径
proxy_redirect off;
}
}
}
网友评论