Advertisement
niammuddin

ngin virtualhost wordpress

Dec 30th, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. server {
  2. listen 80;
  3. server_name www.pendidikan123.com pendidikan123.com;
  4. root /usr/share/nginx/html/pendidikan123.com/public_html;
  5. index index.php index.html index.htm;
  6. access_log /usr/share/nginx/html/pendidikan123.com/logs/pendidikan123.com.access.log;
  7. error_log /usr/share/nginx/html/pendidikan123.com/logs/pendidikan123.com.error.log;
  8.  
  9. if ($host ~* ^www\.(.*))
  10. {
  11. set $host_without_www $1;
  12. rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
  13. }
  14. set $cache_uri $request_uri;
  15.  
  16. # POST requests and urls with a query string should always go to PHP
  17. if ($request_method = POST) {
  18. set $cache_uri 'null cache';
  19. }
  20. if ($query_string != "") {
  21. set $cache_uri 'null cache';
  22. }
  23.  
  24. # Don't cache uris containing the following segments
  25. 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|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
  26. set $cache_uri 'null cache';
  27. }
  28.  
  29. # Don't use the cache for logged in users or recent commenters
  30. if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
  31. set $cache_uri 'null cache';
  32. }
  33.  
  34. # Use cached or actual file if they exists, otherwise pass request to WordPress
  35. location / {
  36. try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php ;
  37. }
  38.  
  39. location = /favicon.ico { log_not_found off; access_log off; }
  40. location = /robots.txt { log_not_found off; access_log off; }
  41.  
  42. location ~ .php$ {
  43. try_files $uri /index.php;
  44. include fastcgi_params;
  45. fastcgi_pass unix:/var/run/php5-fpm.sock;
  46. }
  47.  
  48. # Cache static files for as long as possible
  49. 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)$ {
  50. expires max; log_not_found off; access_log off;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement