walle2.0 nginx.conf配置文件参数

vim /usr/local/nginx/conf
#user nobody;
worker_processes 1;

events {
worker_connections 1024;
}
http{
include vhost/*.conf;
}

 


vim /usr/local/nginx/conf/vhost/walle.conf
include mime.types;
default_type application/octet-stream;
sendfile on;
upstream webservers {
server 0.0.0.0:5000 weight=1; # 负载设置
}

server {
listen 80;
## server_name localhost; # 域名设置
access_log /data/wwwlogs/walle.log combined;
index index.html index.htm; # 日志目录

location / {
try_files $uri $uri/ /index.html;
add_header access-control-allow-origin *;
root /data/wwwroot/walle-web/fe; # 前端代码已集成到walle-web,即walle-web/fe的绝对路径
}

location ^~ /api/ {
add_header access-control-allow-origin *;
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Origin $host:$server_port;
proxy_set_header Referer $host:$server_port;
}

location ^~ /socket.io/ {
add_header access-control-allow-origin *;
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Origin $host:$server_port;
proxy_set_header Referer $host:$server_port;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

# WebScoket Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

 

posted @ 2019-03-07 10:54  也曾少年  阅读(394)  评论(0编辑  收藏  举报