Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 80;
- root /usr/share/nginx/www;
- index index.php;
- server_name website.com www.website.com;
- autoindex off;
- include conf.sites/wordpress-both.conf;
- access_log /var/log/nginx/website.access.log;
- error_log /var/log/nginx/website.error.log error;
- set $cache_uri $request_uri;
- # POST requests and urls with a query string should always go to PHP
- if ($request_method = POST) {
- set $cache_uri 'null cache';
- }
- if ($query_string != "") {
- set $cache_uri 'null cache';
- }
- # Don't cache uris containing the following segments
- if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitem$
- set $cache_uri 'null cache';
- }
- # Don't use the cache for logged in users or recent commenters
- if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
- set $cache_uri 'null cache';
- }
- # Use cached or actual file if they exists, otherwise pass request to WordPress
- location / {
- try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php ;
- # auth_basic "closed site";
- # auth_basic_user_file .htpasswd;
- }
- # Erase this block if the phpmyadmin security configuration below works
- # location /phpmyadmin {
- # try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php ;
- # auth_basic "closed site";
- # auth_basic_user_file htpasswd;
- # }
- location ~* /phpmyadmin/.*\.php$ {
- # try_files $uri = 404;
- fastcgi_split_path_info ^(.+.php)(.*)$;
- fastcgi_index index.php;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- fastcgi_intercept_errors on;
- fastcgi_ignore_client_abort off;
- fastcgi_connect_timeout 60;
- fastcgi_send_timeout 180;
- fastcgi_read_timeout 180;
- fastcgi_buffer_size 128k;
- fastcgi_buffers 4 256k;
- fastcgi_busy_buffers_size 256k;
- fastcgi_temp_file_write_size 256k;
- auth_basic "Password Protected Folder";
- auth_basic_user_file /etc/nginx/.htpasswd;
- }
- location = /favicon.ico { log_not_found off; access_log off; }
- location = /robots.txt { log_not_found off; access_log off; }
- #location / {
- # This is cool because no php is touched for static content.
- # include the "?$args" part so non-default permalinks doesn't break when using query string
- # try_files $uri $uri/ /index.php?$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 {
- #fastcgi_pass 127.0.0.1:9000;
- # With php5-fpm:
- #try_files $uri /index.php;
- try_files $uri =404;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_intercept_errors on;
- include fastcgi_params;
- }
- #location /nginx_status {
- # Turn on stats
- #stub_status on;
- #access_log off;
- # only allow access from 77.103.27.165 #
- #allow 89.177.49.138;
- #deny all;
- #}
- # Cache static files for as long as possible
- location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
- expires max; log_not_found off; access_log off;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement