Advertisement
paradox2k

vhost.conf

Mar 11th, 2015
29
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2.     listen 80;
  3.  
  4.     server_name www.example.com example.com;
  5.  
  6.     access_log /var/log/nginx/example.access.log traffic;
  7.     access_log /var/log/nginx/example.stable.full.log;
  8.     error_log /var/log/nginx/example.stable.error.log;
  9.  
  10.     root /path/to/my/files;
  11.  
  12.     error_page  404  404.html;
  13.  
  14.     autoindex off;
  15.  
  16.     client_max_body_size 0;
  17.  
  18.     index index.php index.html index.htm;
  19.  
  20.     location / {
  21.         rewrite_log on;
  22.         rewrite "^/movies/([^/]+)/(video.mp4)$" /movie.php?key=$1&vid=$2 last;
  23.     }  
  24.      
  25.     location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
  26.         access_log        off;
  27.         log_not_found     off;
  28.         expires           30d;
  29.         add_header Pragma public;
  30.                 add_header Cache-Control "public, must-revalidate";
  31.     }
  32.  
  33.     #use fastcgi for all php files
  34.         location ~ .php$ {
  35.                 error_page 404 404.php;
  36.                 gzip on;
  37.                 try_files $uri =404;
  38.                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
  39.                 fastcgi_pass unix:/var/run/php5-fpm.sock;
  40.         fastcgi_max_temp_file_size 15360m;
  41.                 fastcgi_read_timeout 150s;
  42.                 fastcgi_buffers 8 128k;
  43.                 fastcgi_buffer_size 256k;
  44.                 fastcgi_index index.php;
  45.                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  46.         #fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  47.                 include fastcgi_params;
  48.     }
  49.    
  50.     location ~ /\. {
  51.         access_log off;
  52.         log_not_found off;
  53.         deny all;
  54.     }
  55.  
  56.     #deny access to apache .htaccess files
  57.         location ~ /\.ht {
  58.         deny all;
  59.     }
  60. }
  61.  
  62. #####################################Example API Mode (For external downloader & clients)#######################################
  63. server
  64. {
  65.     server_name api.example.com;
  66.  
  67.     access_log /var/log/nginx/example.api.access.log;
  68.     error_log /var/log/nginx/example.api.error.log;
  69.  
  70.     root /path/to/my/api;
  71.    
  72.     error_page  404  404.html;
  73.  
  74.     index index.php index.html index.htm;
  75.    
  76.     client_max_body_size 0;
  77.  
  78.     # use fastcgi for all php files
  79.     location ~ \.php$ {
  80.         gzip on;
  81.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  82.         fastcgi_index index.php;
  83.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  84.         fastcgi_read_timeout 150s;
  85.         fastcgi_buffers 8 128k;
  86.         fastcgi_buffer_size 256k;
  87.         include fastcgi_params;
  88.     }
  89.  
  90.     # deny access to apache .htaccess files
  91.     location ~ /\.ht {
  92.         deny all;
  93.     }
  94. }
  95. #####################################/Example API Mode ()for external downloader & clients)######################################
Advertisement
RAW Paste Data Copied
Advertisement