配置nginx参数配置
server {
listen 80;
server_name 127.0.0.1;
root 项目存放完整路径;
#charset koi8-r;
#access_log logs/host.access.log main;
location /front {
#root html;
#index index.html index.htm;
proxy_pass http://127.0.0.1:8080/front;
client_max_body_size 100m;
}
location /userInfo{
if ( $query_string ~* ^(.*)userName=xiaoming(.*)$ ){
proxy_pass http://127.0.0.1:9081;
}
if ( $query_string ~* ^(.*)userName=xiaohua(.*)$ ){
proxy_pass http://127.0.0.1:9082;
}
}
location / {
index index.html;
try_files $uri $uri/ /index.html;
}
}
本文详细介绍了Nginx服务器的参数配置方法,包括监听端口、服务器名称、项目根目录设置,以及如何通过location指令配置代理传递,实现不同条件下的请求转发。特别展示了基于用户名的动态请求转发配置。
777

被折叠的 条评论
为什么被折叠?



