值得一读:
https://www.linode.com/docs/web-servers/nginx/how-to-configure-nginx/
-
Even Miller的模块教程(长期更新) https://www.evanmiller.org/nginx-modules-guide.html
-
nginx的架构详解 http://www.aosabook.org/en/nginx.html
值得一读:
https://www.linode.com/docs/web-servers/nginx/how-to-configure-nginx/
Even Miller的模块教程(长期更新) https://www.evanmiller.org/nginx-modules-guide.html
nginx的架构详解 http://www.aosabook.org/en/nginx.html
# proxy cache | |
# cache store specified as keys_zone, 10m is size limit | |
proxy_cache_path /usr/local/etc/nginx/cache-api levels=1 keys_zone=cache-api:10m; | |
# upstream http module | |
upstream foo { | |
server 127.0.0.1:8093 weight=2 max_fails=3 fail_timeout=10s; | |
server 127.0.0.1:8094 weight=2 max_fails=3 fail_timeout=10s; | |
# ... | |
} | |
server { | |
listen 8081; | |
location / { | |
proxy_pass http://foo; | |
real_ip_header 127.0.0.1/44443; | |
} | |
# cache... | |
location /cache { | |
proxy_pass http://foo; | |
proxy_cache cache-api; | |
proxy_cache_valid 200 10s; | |
} | |
# proxy map location to http | |
location /foo/ { | |
proxy_pass http://foo; | |
} | |
# deny | |
location = /deny/index {deny all;} | |
} |
server { | |
listen 80 default_server; | |
server_name www.example.com; | |
location / { | |
# which dir files locating in | |
root /usr/share/nginx/html; | |
# alias /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
} |
参考:
https://www.cnblogs.com/jun1019/p/6260662.html