Advertisement
Guest User

nginx last

a guest
Jan 12th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.15 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name mail.example.com;
  4.     return 301 https://$http_host$request_uri;
  5. }
  6.  
  7. server {
  8.    
  9.     # base domain
  10.     index index.php;
  11.    
  12.     server_name mail.example.com;
  13.    
  14.     listen 443 ssl default_server;
  15.    
  16.     root /usr/share/rainloop/public_html;
  17.    
  18.     ssl_certificate /etc/nginx/ssl/mail.example.com.crt;
  19.     ssl_certificate_key /etc/nginx/ssl/mail.example.com.key.txt;
  20.    
  21.     ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
  22.     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  23.     ssl_prefer_server_ciphers on;
  24.     ssl_session_cache shared:SSL:10m;
  25.     ssl_session_timeout 5m;
  26.    
  27.     client_max_body_size 8M;
  28.    
  29.     location / {
  30.         try_files $uri $uri/ /index.php?$query_string;
  31.     }
  32.        
  33.     location ~ \.php$ {
  34.         fastcgi_index index.php;
  35.         fastcgi_split_path_info ^(.+\.php)(.*)$;
  36.         fastcgi_keep_conn on;
  37.         include /etc/nginx/fastcgi_params;
  38.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  39.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  40.     }
  41.  
  42.     # phpmyadmin
  43.     location /phpmyadmin {
  44.         root /usr/share/;
  45.         index index.php index.html index.htm;
  46.         location ~ ^/phpmyadmin/(.+\.php)$ {
  47.             try_files $uri =404;
  48.             root /usr/share/;
  49.             fastcgi_pass    unix:/var/run/php5-fpm.sock;
  50.             fastcgi_index index.php;
  51.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  52.             include fastcgi_params;
  53.         }
  54.         location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
  55.            root /usr/share/;
  56.         }
  57.         error_log   /var/log/nginx/phpmyadmin.error.log;
  58.         access_log  /var/log/nginx/phpmyadmin.access.log;
  59.     }
  60.    
  61.     # vimbadmin
  62.     location /vimbadmin {
  63.         autoindex on;
  64.         alias /usr/share/vimbadmin/public;
  65.         location ~ ^(.+\.php)$ {
  66.             try_files $uri =404;
  67.             fastcgi_split_path_info ^(.+\.php)(/.+)$;
  68.             fastcgi_pass unix:/var/run/php5-fpm.sock;
  69.             fastcgi_param SCRIPT_FILENAME $request_filename;
  70.             include fastcgi_params;
  71.         }
  72.     }
  73.    
  74.     location ~ /\.ht {
  75.         deny all;
  76.     }
  77.  
  78.     location ^~ /data {
  79.       deny all;
  80.     }
  81.    
  82.     error_log   /var/log/nginx/mail.example.com.error.log;
  83.     access_log  /var/log/nginx/mail.example.com.access.log;
  84. }
  85.  
  86. server {
  87.     listen      1337;
  88.     server_name mail.example.com;
  89.     root        /usr/share/vimbadmin/public;
  90.  
  91.     index index.php;
  92.  
  93.     # Logs
  94.     error_log   /var/log/nginx/vimbadmin.error.log;
  95.     access_log  /var/log/nginx/vimbadmin.access.log;
  96.  
  97.     location / {
  98.         try_files $uri $uri/ /index.php?$args;
  99.     }
  100.  
  101.     # Pass the PHP scripts to FastCGI server
  102.     location ~ \.php$ {
  103.         # Prevent Zero-day exploit
  104.         try_files $uri =404;
  105.  
  106.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  107.         #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  108.  
  109.         fastcgi_pass    unix:/var/run/php5-fpm.sock;
  110.         fastcgi_index   index.php;
  111.         include         fastcgi_params;
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement