nginx高级配置
配置文件说明
路由匹配
别名
网页跳转
return
rewrite
配置SSL
nginx代理规则
负载均衡
nginx负载均衡的实现是基于反向代理机制
通过nginx代理到其它服务
1.nginx配置server
2.通过web访问
nginx过滤请求路径
location /devops/monitor/ { #请求全部转给后端的Grafana proxy_pass http://nginx-node1:3000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location / { #root /home/taishi/nginx/html/; index index.html index.htm; client_max_body_size 100m; #limit_conn one 10; limit_rate 10240k; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ^~ /webcdn/ { alias /home/taishi/nginx/resources/; autoindex on; access_log off; expires 30d; } location ^~ /webcdn/*\.(jpg|jpeg|png|gif|ico|css|js|gz)$ { log_not_found off; # 关闭日志 access_log off; expires 30d; }
本文来自博客园,作者:不懂123,转载请注明原文链接:https://www.cnblogs.com/yxh168/p/15101777.html