Advertisement
Replace

example.com nginx configuration

Jan 6th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.39 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.     server_name example.com;
  4.     return 301 https://$http_host$request_uri;
  5. }
  6.  
  7. server {
  8.    
  9.     # base domain
  10.     listen 443 ssl default_server;
  11.     server_name example.com;
  12.     ssl_certificate /etc/nginx/ssl/nginx.crt;
  13.     ssl_certificate_key /etc/nginx/ssl/nginx.key;
  14.    
  15.     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";
  16.     ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  17.     ssl_prefer_server_ciphers on;
  18.     ssl_session_cache shared:SSL:10m;
  19.     ssl_session_timeout 5m;
  20.    
  21.     # rainloop
  22.     location /webmail {
  23.         index index.php;
  24.         alias /usr/share/rainloop/public_html/;
  25.         location ~ ^/webmail/\.ht {
  26.             deny all;
  27.         }
  28.         location ~ ^/webmail/data {
  29.             deny all;
  30.         }
  31.         location ~ ^/webmail/(.+\.php)$ {
  32.             try_files $uri =404;
  33.             fastcgi_pass unix:/var/run/php5-fpm.sock;
  34.             fastcgi_index index.php;
  35.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  36.             include fastcgi_params;
  37.         }
  38.     }
  39.    
  40.     # vimbadmin
  41.     location /vimbadmin {
  42.         autoindex on;
  43.         alias /usr/share/vimbadmin/public;
  44.         location ~ ^(.+\.php)$ {
  45.             root /usr/share/vimbadmin/public;
  46.             try_files $uri =404;
  47.             fastcgi_split_path_info ^(.+\.php)(/.+)$;
  48.             fastcgi_pass unix:/var/run/php5-fpm.sock;
  49.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  50.             include fastcgi_params;
  51.         }
  52.     }
  53.    
  54.     # phpmyadmin
  55.     location /phpmyadmin {
  56.         root /usr/share/;
  57.         index index.php index.html index.htm;
  58.         location ~ ^/phpmyadmin/(.+\.php)$ {
  59.             try_files $uri =404;
  60.             root /usr/share/;
  61.             fastcgi_pass    unix:/var/run/php5-fpm.sock;
  62.             fastcgi_index index.php;
  63.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  64.             include fastcgi_params;
  65.         }
  66.         location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
  67.            root /usr/share/;
  68.         }
  69.     }
  70.    
  71.     location ~ ^/(.+\.php)$ {
  72.         try_files $uri =404;
  73.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  74.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  75.         fastcgi_index index.php;
  76.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  77.         include fastcgi_params;
  78.     }
  79.    
  80.     error_log   /var/log/nginx/example.com.error.log;
  81.     access_log  /var/log/nginx/example.com.access.log;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement