Advertisement
Guest User

Nginx WP/CI Confusion - RESOLVED

a guest
Aug 25th, 2011
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.29 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name dimasrocks.com;
  4.     root /var/www/dimasrocks.com/public_html;
  5.     index index.php index.html index.htm;
  6.     #access_log logs/host.access.log;
  7.  
  8. location  / {
  9.         # this serves static files that exist without running other rewrite tests
  10.         if (-f \$request_filename) {
  11.             expires 30d;
  12.             break;
  13.         }
  14.         # this sends all non-existing file or directory requests to index.php
  15.         if (!-e $request_filename) {
  16.             rewrite ^/css/(.)$ /wp-content/themes/roots/css/$1 last;
  17.             rewrite ^/js/(.)$ /wp-content/themes/roots/js/$1 last;
  18.             rewrite ^/img/(.)$ /wp-content/themes/roots/img/$1 last;
  19.             rewrite ^/plugins/(.)$ /wp-content/plugins/$1 last;
  20.             rewrite ^/(.*)$ /index.php last;
  21.         }
  22.     }
  23.  
  24. location  /codeigniter_app/ {
  25.  
  26.     # canonicalize codeigniter url end points
  27.     # if your default controller is something other than "welcome" you should change the following
  28.     if ($request_uri ~* ^(/codeigniter_app/scratch(/index)?|/index(.php)?)/?$)
  29.     {
  30.         rewrite ^(.*)$ /codeigniter_app/ permanent;
  31.     }
  32.  
  33.     # removes trailing "index" from all controllers
  34.     if ($request_uri ~* index/?$)
  35.     {
  36.         rewrite ^/(.*)/index/?$ /$1 permanent;
  37.     }
  38.  
  39.     # removes trailing slashes (prevents SEO duplicate content issues)
  40.     if (!-d $request_filename)
  41.     {
  42.         rewrite ^/(.+)/codeigniter_app/$1 permanent;
  43.     }
  44.  
  45.     # removes access to "system" folder, also allows a "System.php" controller
  46.     if ($request_uri ~* ^/codeigniter_app/system)
  47.     {
  48.         rewrite ^/(.*)$ /codeigniter_app/index.php?/$1 last;
  49.         break;
  50.     }
  51.  
  52.  
  53. if (!-e $request_filename) {
  54.             rewrite ^/(.*)$ /codeigniter_app/index.php?/$1 last;
  55.         }
  56.  
  57. }
  58.  
  59.  
  60.     location = /favicon.ico {
  61.         log_not_found off;
  62.         access_log off;
  63.     }
  64.     location = /robots.txt {
  65.         allow all;
  66.         log_not_found off;
  67.         access_log off;
  68.     }
  69.     location ~ \.php$ {
  70.         root public_html;
  71.         fastcgi_pass 127.0.0.1:9000;
  72.         fastcgi_param SCRIPT_FILENAME /var/www/dimasrocks.com/public_html/$fastcgi_script_name;
  73.         include fastcgi_params;
  74.     }
  75.     location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
  76.         expires max;
  77.         log_not_found off;
  78.         root /var/www/dimasrocks.com/public_html/;
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement