Nginx实现前后端分离
#usernobody;
worker_processes1;
#error_loglogs/error.log;
#error_loglogs/error.lognotice;
#error_loglogs/error.loginfo;
#pidlogs/nginx.pid;
events{
worker_connections1024;
}
http{
includemime.types;
default_typeapplication/octet-stream;
#sendfileon;
#tcp_nopushon;
#keepalive_timeout0;
keepalive_timeout65;
proxy_set_headerCookie$http_cookie;
proxy_set_headerX-Forwarded-Host$host;
proxy_set_headerX-Forwarded-Server$host;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
gzipon;
sendfileon;
server{
listen8100;
server_namelocalhost;
location=/{
root/Users/abee/WebstormProjects/Angular/dist;
indexindex.htmlindex.htm;
try_files$uri$uri//index.html=404;
}
location~*\.(js|css|htm|html|gif|jpg|jpeg|png|bmp)${
root/Users/abee/WebstormProjects/Angular/dist;
}
location/{
proxy_passhttp://localhost:8200/;
}
}
}
如果有多个server端location可使用另一种配置
location/server1/{
proxy_passhttp://localhost:8300/;
}
以上就是本次给大家带来的关于Nginx实现前后端分离的全部内容,感谢你对毛票票的支持。
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短