HosipLan

Untitled

Feb 13th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hosiplan@hosiplan-thinkpad:/usr/local/nginx/conf$ cat nginx.conf
  2.  
  3. #user  nobody;                                                                                                                                                                                      
  4. worker_processes  1;                                                                                                                                                                                
  5.                                                                                                                                                                                                      
  6. #error_log  logs/error.log;                                                                                                                                                                          
  7. #error_log  logs/error.log  notice;                                                                                                                                                                  
  8. #error_log  logs/error.log  info;                                                                                                                                                                    
  9.                                                                                                                                                                                                      
  10. #pid        logs/nginx.pid;                                                                                                                                                                          
  11.                                                                                                                                                                                                      
  12.  
  13. events {
  14.     worker_connections  1024;
  15. }
  16.  
  17.  
  18. http {
  19.     include       mime.types;
  20.     default_type  application/octet-stream;
  21.  
  22.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  23.     #                  '$status $body_bytes_sent "$http_referer" '
  24.     #                  '"$http_user_agent" "$http_x_forwarded_for"';
  25.  
  26.     #access_log  logs/access.log  main;
  27.  
  28.     sendfile        on;
  29.     #tcp_nopush     on;
  30.  
  31.     #keepalive_timeout  0;
  32.     keepalive_timeout  65;
  33.  
  34.     #gzip  on;
  35.  
  36.     include nginx.hosts.conf;
  37.     include nginx.damejidlo.conf;
  38. }
  39.  
  40.  
  41.  
  42. hosiplan@hosiplan-thinkpad:/usr/local/nginx/conf$ cat nginx.hosts.conf
  43. server {
  44. #       listen          192.168.0.100:80;
  45. #       listen          192.168.1.100:80;
  46.         listen          127.0.0.1:80;
  47.         listen          80;
  48.  
  49.         server_name     ~^(:?(?<second>.+)\.)?(?<domain>[^.]+\.[^.]+)$;
  50.         index           index.php index.html;
  51.  
  52.         set             $try_dir $domain;
  53.         if (-d /var/www/hosts/$second.$domain) {
  54.                 set     $try_dir $second.$domain;
  55.         }
  56.         root            /var/www/hosts/$try_dir;
  57.  
  58.         location / {
  59.                 try_files       $uri $uri/ /index.php;
  60.         }
  61.  
  62.         keepalive_timeout  0;
  63.         send_timeout    9999999;
  64.         fastcgi_read_timeout    999999;
  65.         client_max_body_size    1024M;
  66.  
  67.         location ~ \.php$ { # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  68.                 include         fastcgi_params;
  69.                 fastcgi_param   SERVER_NAME     $try_dir;
  70.                 fastcgi_pass    127.0.0.1:9000;
  71.                 fastcgi_index   index.php;
  72.  
  73.                 fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
  74.                 fastcgi_param   PATH_INFO $fastcgi_path_info;
  75.                 fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
  76.  
  77.                 fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
  78.  
  79.                 try_files $uri =404;
  80.         }
  81.  
  82.         #location ~ \.(js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ { }
  83.  
  84.         location ~ /\.(ht|gitignore) { # deny access to .htaccess files, if Apache's document root concurs with nginx's one
  85.             deny all;
  86.         }
  87.  
  88.         location ~ \.(neon|ini|log|yml)$ { # deny access to configuration files
  89.             deny all;
  90.         }
  91.  
  92.         location = /robots.txt  { access_log off; log_not_found off; }
  93.         location = /humans.txt  { access_log off; log_not_found off; }
  94.         location = /favicon.ico { access_log off; log_not_found off; }
  95.     }
Advertisement
Add Comment
Please, Sign In to add comment