Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 80;
- server_name www.example.com example.com;
- access_log /var/log/nginx/example.access.log traffic;
- access_log /var/log/nginx/example.stable.full.log;
- error_log /var/log/nginx/example.stable.error.log;
- root /path/to/my/files;
- error_page 404 404.html;
- autoindex off;
- client_max_body_size 0;
- index index.php index.html index.htm;
- location / {
- rewrite_log on;
- rewrite "^/movies/([^/]+)/(video.mp4)$" /movie.php?key=$1&vid=$2 last;
- }
- location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
- access_log off;
- log_not_found off;
- expires 30d;
- add_header Pragma public;
- add_header Cache-Control "public, must-revalidate";
- }
- #use fastcgi for all php files
- location ~ .php$ {
- error_page 404 404.php;
- gzip on;
- try_files $uri =404;
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_max_temp_file_size 15360m;
- fastcgi_read_timeout 150s;
- fastcgi_buffers 8 128k;
- fastcgi_buffer_size 256k;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- #fastcgi_param SCRIPT_NAME $fastcgi_script_name;
- include fastcgi_params;
- }
- location ~ /\. {
- access_log off;
- log_not_found off;
- deny all;
- }
- #deny access to apache .htaccess files
- location ~ /\.ht {
- deny all;
- }
- }
- #####################################Example API Mode (For external downloader & clients)#######################################
- server
- {
- server_name api.example.com;
- access_log /var/log/nginx/example.api.access.log;
- error_log /var/log/nginx/example.api.error.log;
- root /path/to/my/api;
- error_page 404 404.html;
- index index.php index.html index.htm;
- client_max_body_size 0;
- # use fastcgi for all php files
- location ~ \.php$ {
- gzip on;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_read_timeout 150s;
- fastcgi_buffers 8 128k;
- fastcgi_buffer_size 256k;
- include fastcgi_params;
- }
- # deny access to apache .htaccess files
- location ~ /\.ht {
- deny all;
- }
- }
- #####################################/Example API Mode ()for external downloader & clients)######################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement