HosipLan

Untitled

Jun 12th, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # $ cat /usr/local/nginx/conf/http.hosts.conf
  2.  
  3. server {
  4.         listen          80;
  5.         server_name     ~^(:?(?<second>.+)\.)?(?<domain>[^.]+\.[^.]+)$;
  6.         index           index.php index.html;
  7.  
  8.         set             $try_dir $domain;
  9.         if (-d /var/www/hosts/$second.$domain) {
  10.                 set     $try_dir $second.$domain;
  11.         }
  12.         root            /var/www/hosts/$try_dir;
  13.  
  14.         access_log      /var/log/nginx/access.$try_dir.log;
  15.         error_log       /var/log/nginx/error.log;
  16.  
  17.         location / {
  18.                 try_files       $uri $uri/ /index.php?$args;
  19.         }
  20.  
  21.         keepalive_timeout  0;
  22.         fastcgi_read_timeout    999999;
  23.  
  24.         client_body_in_file_only clean;
  25.         client_body_buffer_size 32K;
  26.                                                                                                                                                                                                      
  27.         client_max_body_size 300M;                                                                                                                                                                  
  28.                                                                                                                                                                                                      
  29.         sendfile on;                                                                                                                                                                                
  30.         send_timeout 1024s;                                                                                                                                                                          
  31.                                                                                                                                                                                                      
  32.         location ~ [^/]\.php(/|$) {                                                                                                                                                                  
  33.                 fastcgi_split_path_info ^(.+?\.php)(/.*)$;                                                                                                                                          
  34.                                                                                                                                                                                                      
  35.                 fastcgi_pass    127.0.0.1:9000;
  36.                 fastcgi_index   index.php;
  37.                 include         fastcgi_params;
  38.  
  39.                 fastcgi_param   PATH_INFO $fastcgi_path_info;
  40.                 fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
  41.                 fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
  42.                 fastcgi_param   PHP_VALUE "newrelic.appname=$domain";
  43.  
  44.                 try_files $uri =404;
  45.         }
  46.  
  47.         #location ~ \.(js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ { }
  48.  
  49.         location ~ /\.(ht|gitignore) { # deny access to .htaccess files, if Apache's document root concurs with nginx's one
  50.             deny all;
  51.         }
  52.  
  53.         location ~ \.(neon|ini|log|yml)$ { # deny access to configuration files
  54.             deny all;
  55.         }
  56.  
  57.         location = /robots.txt  { access_log off; log_not_found off; }
  58.         location = /favicon.ico { access_log off; log_not_found off; }
  59.     }
Advertisement
Add Comment
Please, Sign In to add comment