Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #user nobody;
- worker_processes 2;
- error_log /var/log/nginx/error.log;
- #error_log logs/error.log notice;
- #error_log logs/error.log info;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- # '$status $body_bytes_sent "$http_referer" '
- # '"$http_user_agent" "$http_x_forwarded_for"';
- access_log /var/log/nginx/access.log;
- sendfile on;
- tcp_nopush on;
- #keepalive_timeout 0;
- keepalive_timeout 65;
- gzip on;
- # drupal host's
- server {
- listen 127.0.0.1:80;
- server_name ~^(www\.)?(?<domain>.+)$;
- root /home/www/drupal/$domain/public_html;
- #charset utf-8;
- access_log /home/www/drupal/$domain/logs/access.log;
- client_max_body_size 0;
- location @rewrite {
- # Some modules enforce no slash (/) at the end of the URL
- # Else this rewrite block wouldn't be needed (GlobalRedirect)
- rewrite ^/(.*)$ /index.php?q=$1;
- }
- location / {
- # This is cool because no php is touched for static content
- try_files $uri @rewrite;
- }
- # Fighting with ImageCache? This little gem is amazing.
- location ~ ^/sites/.*/files/imagecache/ {
- try_files $uri @rewrite;
- }
- # Patch image styles for D7 too.
- location ~ ^/sites/.*/files/styles/ {
- try_files $uri @rewrite;
- }
- location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
- expires max;
- log_not_found off;
- }
- location ~ \..*/.*\.php$ {
- return 403;
- }
- location = /favicon.ico {
- log_not_found off;
- access_log off;
- }
- location = /robots.txt {
- allow all;
- log_not_found off;
- access_log off;
- }
- # Very rarely should these ever be accessed outside of your lan
- location ~* \.(txt|log)$ {
- allow 127.0.0.0/8;
- deny all;
- }
- location ~ \.php$ {
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- include fastcgi_params;
- #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_intercept_errors on;
- fastcgi_read_timeout 300;
- fastcgi_hide_header X-Powered-By;
- fastcgi_pass unix:/var/run/php/php-fpm.sock;
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- location ~/\.ht {
- deny all;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment