Skip to content

Instantly share code, notes, and snippets.

@lgh06
Last active June 17, 2018 15:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lgh06/9fcccf6e9a7d5402c5bbba7587d772d3 to your computer and use it in GitHub Desktop.
Save lgh06/9fcccf6e9a7d5402c5bbba7587d772d3 to your computer and use it in GitHub Desktop.
nginx location rewrite proxy_pass
#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;
}
}
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;
}
}
@lgh06
Copy link
Author

lgh06 commented Apr 12, 2017

inside http:
proxy_cache_path /data/vhosts/kankan.com/m/ttkkcache levels=1:2 keys_zone=ttkkh5share:20m inactive=10m max_size=500m;

@lgh06
Copy link
Author

lgh06 commented Apr 12, 2017

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