HosipLan

Untitled

Aug 17th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2. #       listen          192.168.0.100:80;
  3.         listen          127.0.0.1:80;
  4.         server_name     ~^(:?(?<second>.+)\.)?(?<domain>[^.]+\.[^.]+)$;
  5.         index           index.php index.html;
  6.  
  7.         set             $try_dir $domain;
  8.         if (-d /var/www/hosts/$second.$domain) {
  9.                 set     $try_dir $second.$domain;
  10.         }
  11.         root            /var/www/hosts/$try_dir;
  12.  
  13.         location / {
  14.                 try_files       $uri $uri/ /index.php;                                                                                                                                  
  15.         }                                                                                                                                                                              
  16.                                                                                                                                                                                        
  17.         keepalive_timeout  0;
  18.         send_timeout    9999999;
  19.         fastcgi_read_timeout    999999;
  20.         client_max_body_size    200M;
  21.  
  22.         location ~ \.php$ { # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  23.                 include         fastcgi_params;
  24.                 fastcgi_param   SERVER_NAME     $try_dir;
  25.                 fastcgi_pass    127.0.0.1:9000;
  26.                 fastcgi_index   index.php;
  27.  
  28.                 fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
  29.                 fastcgi_param   PATH_INFO $fastcgi_path_info;
  30.                 fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
  31.  
  32.                 fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
  33.  
  34.                 try_files $uri =404;
  35.         }
  36.  
  37.         #location ~ \.(js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ { }
  38.  
  39.         location ~ /\.(ht|git) { # deny access to .htaccess files, if Apache's document root concurs with nginx's one
  40.             deny all;
  41.         }
  42.  
  43.         location ~ \.(neon|ini|log|yml)$ { # deny access to configuration files
  44.             deny all;
  45.         }
  46.  
  47.         location = /robots.txt  { access_log off; log_not_found off; }
  48.         location = /humans.txt  { access_log off; log_not_found off; }
  49.         location = /favicon.ico { access_log off; log_not_found off; }
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment