Last active
June 17, 2018 15:41
-
-
Save lgh06/9fcccf6e9a7d5402c5bbba7587d772d3 to your computer and use it in GitHub Desktop.
nginx location rewrite proxy_pass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#39测试机 | |
server { | |
listen 80; | |
server_name m.kankan.com; | |
root /data/vhosts/kankan.com/m/public_html; | |
location / { | |
ssi on; | |
ssi_silent_errors on; | |
ssi_types text/shtml; | |
index index.php index.html index.htm; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
include fastcgi.conf; | |
} | |
location ~ /ttkkshare/d/(.*)\.html$ { | |
expires 1h; | |
rewrite /d/(.*)\.html$ /ttkkshare/duan.php?vid=$1; | |
} | |
location ~* /ttkkshare/d/(.*)\.(png|css|js|jpg|jpeg|ico|map)$ { | |
expires 1d; | |
rewrite (?i)/d/(.*)\.(png|css|js|jpg|jpeg|ico|map)$ /ttkkshare/$1.$2 break; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name m.kankan.com; | |
root /data/vhosts/kankan.com/m/public_html; | |
location / { | |
ssi on; | |
ssi_silent_errors on; | |
ssi_types text/shtml; | |
index index.php index.html index.htm; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
include fastcgi.conf; | |
} | |
location ~ /ttkkshare/(.+)\.html$ { | |
rewrite /d/(.*)\.html$ /ttkkshare/duan.php?vid=$1 break; | |
proxy_pass http://192.168.28.52:80; | |
} | |
location ~ /ttkkshare/ { | |
rewrite /ttkkshare/(.+)$ /$1; | |
#rewrite /d/(.*)\.html$ /index.html?type=duan&vid=$1 break; | |
rewrite (?i)/d/(.*)\.(png|css|js|jpg|jpeg|ico|map)$ /$1.$2 break; | |
proxy_pass http://192.168.28.52:8080; | |
} | |
} |
inside http:
proxy_cache_path /data/vhosts/kankan.com/m/ttkkcache levels=1:2 keys_zone=ttkkh5share:20m inactive=10m max_size=500m;
inside location:
proxy_cache ttkkh5share;
proxy_cache_valid 200 302 10m;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
http://wangwei007.blog.51cto.com/68019/1103734
http://blog.csdn.net/xy2204/article/details/47749405
http://serverfault.com/questions/498855/nginx-case-insensitive-rewrite