admin.conf:nginx
upstream local{git
server localhost:19003 weight=1; #本地服務器web
}後端
server{api
listen 19001 default_server;服務器
server_name 127.0.0.1;app
access_log /root/logs/nginx/admin.kaoke.me.access.log;spa
error_log /root/logs/nginx/admin.kaoke.me.error.log;server
location /{rem
uwsgi_pass 127.0.0.1:19000;
include /usr/local/etc/nginx/uwsgi_params;
client_max_body_size 100m;
uwsgi_connect_timeout 70s;
uwsgi_send_timeout 1000s;
uwsgi_read_timeout 180s;
}
location ~^/static/{
root /Users/self/git/liantong-web-static/web_statics/admin.kaoke.me;
expires 1d;
}
location ~^/smedia/{
root /;
expires 1d;
}
location /iapi/ {#loaction 匹配127.0.0.1:19001中的地址是否有/iapi/開頭的若是有這個地址轉到127.0.0.1:19003
#DemoBackend1後面的斜槓是一個關鍵,沒有斜槓的話就會傳遞service到後端節點致使404
proxy_pass http://local/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
www.conf:
server {
listen 19003 default_server;
server_name 127.0.0.1;
location /{
uwsgi_pass 127.0.0.1:19002;
include /usr/local/etc/nginx/uwsgi_params;
client_max_body_size 100m;
uwsgi_connect_timeout 70s;
uwsgi_send_timeout 1000s;
uwsgi_read_timeout 180s;
}
location ~^/static/{
root /Users/self/git/liantong-web-static/web_statics/www.kaoke.me;
expires 1d;
}
# location ~^/download/ {
# root /smedia/app/sdasw;
# expires 1d;
# }
}