HosipLan

Untitled

May 17th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. server {
  2.         listen          80;
  3.         server_name     ~^(:?(?<second>.+)\.)?(?<domain>[^.]+\.[^.]+)$;
  4.         index           index.php index.html;
  5.  
  6.         location / {
  7.                 set             $try_dir $domain;
  8.                 if (-d /var/www/hosts/$second.$domain) {
  9.                         set     $try_dir $second.$domain;
  10.                 }
  11.  
  12.                 root            /var/www/hosts/$try_dir;
  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.                set             $try_dir $domain;
  23.                 if (-d /var/www/hosts/$second.$domain) {
  24.                         set     $try_dir $second.$domain;
  25.                 }
  26.  
  27.                 root            /var/www/hosts/$try_dir;
  28.                 include         fastcgi_params;
  29.                 fastcgi_pass    127.0.0.1:9000;
  30.                 fastcgi_index   index.php;
  31.  
  32.                 fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
  33.                 fastcgi_param   PATH_INFO $fastcgi_path_info;
  34.                 fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
  35.  
  36.                 fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
  37.  
  38.                 try_files $uri $uri/ =404;
  39.         }
  40.  
  41.  
  42.         #location ~ \.(js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ { }
  43.        location ~ /\.ht { # deny access to .htaccess files, if Apache's document root concurs with nginx's one
  44.            deny  all;
  45.         }
  46.  
  47.         location = /robots.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