HosipLan

Untitled

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