Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
- fastcgi_cache_key "$scheme$request_method$host$request_uri";
- add_header X-Cache $upstream_cache_status;
- server {
- listen 80;
- root /var/www/site1/wordpress;
- index index.php index.html index.htm;
- server_name example.com www.example.com;
- location / {
- try_files $uri $uri/ /index.php?q=$uri&$args;
- }
- error_page 404 /404.html;
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/www;
- }
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- location ~ \.php$ {
- try_files $uri =404;
- #fastcgi_pass 127.0.0.1:9000;
- # With php5-fpm:
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- fastcgi_cache MYAPP;
- fastcgi_cache_valid 200 60m;
- fastcgi_cache_bypass $no_cache;
- fastcgi_no_cache $no_cache;
- }
- #Cache everything by default
- set $no_cache 0;
- #Don't cache POST requests
- if ($request_method = POST)
- {
- set $no_cache 1;
- }
- #Don't cache if the URL contains a query string
- if ($query_string != "")
- {
- set $no_cache 1;
- }
- #Don't cache the following URLs
- if ($request_url ~* "/(administrator/|login.php)")
- {
- set $no_cache 1;
- }
- #Don't cache if there is a cookie called PHPSESSID
- if ($http_cookie = "PHPSESSID")
- {
- set $no_cache 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement