Advertisement
EpicCDN

Nginx c

Oct 29th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.65 KB | None | 0 0
  1. server {
  2.         listen 80; ## listen for ipv4; this line is default and implied
  3.         #listen   [::]:80 default ipv6only=on; ## listen for ipv6
  4.  
  5.         root /data-ebs/websites/site1/public_html;
  6.         index index.php index.html index.htm;
  7.  
  8.         # Make site accessible from http://localhost/
  9.         server_name www.site1.com;
  10.  
  11.         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  12.         #
  13.  
  14.         location = /favicon.ico {
  15.                 log_not_found off;
  16.                 access_log off;
  17.         }
  18.  
  19.         location = /robots.txt {
  20.                 allow all;
  21.                 log_not_found off;
  22.                 access_log off;
  23.         }
  24.  
  25.  
  26.         location / {
  27.                 # This is cool because no php is touched for static content.
  28.                 # include the "?$args" part so non-default permalinks doesn't break when using query string
  29.                 try_files $uri $uri/ /index.php?$args;
  30.                 #proxy_cache_valid    any 1m;
  31.                 proxy_cache_valid    500 2s;
  32.                 expires              1m;
  33.         }
  34.  
  35.         location /autos/ {
  36.                 #rewrite ^ https://www.crhoy.com$request_uri? permanent;
  37.                 try_files $uri $uri/ /autos/index.php?$args;
  38.         }
  39.  
  40.         set $cache_uri $request_uri;
  41.  
  42.         location ~ \.php$ {
  43.                 ##
  44.                 # Fastcgi cache
  45.                 ##
  46.                 set $skip_cache 1;
  47.                 if ($cache_uri != "null cache") {
  48.                         add_header X-Cache-Debug "$cache_uri $cookie_nocache $arg_nocache$arg_comment $http_pragma $http_authorization";
  49.                         set $skip_cache 0;
  50.                 }
  51.                 fastcgi_cache_bypass $skip_cache;
  52.                 fastcgi_cache microcache;
  53.                 fastcgi_cache_key $scheme$host$request_uri$request_method;
  54.                 fastcgi_cache_valid any 8m;
  55.                 fastcgi_cache_bypass $http_pragma;
  56.                 fastcgi_cache_use_stale updating error timeout invalid_header http_500;
  57.                 fastcgi_read_timeout 150;
  58.  
  59.                 try_files $uri =404;
  60.                 #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  61.                 include fastcgi.conf;
  62.  
  63.                 fastcgi_connect_timeout 60;
  64.  
  65.                 fastcgi_intercept_errors on;
  66.                 fastcgi_pass php;
  67.         }
  68.        
  69.         location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
  70.                 add_header Access-Control-Allow-Origin *;
  71.                 access_log off; log_not_found off; expires max;
  72.         }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement