Advertisement
Guest User

nginx.conf

a guest
Dec 22nd, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.54 KB | None | 0 0
  1. worker_processes  1;
  2.  
  3. events {
  4.     worker_connections  1024;
  5. }
  6.  
  7. http {
  8.     include                         mime.types;
  9.     default_type                    application/octet-stream;
  10.     sendfile                        on;
  11.     tcp_nopush                      on;
  12.     tcp_nodelay                     on;
  13.     keepalive_timeout               65;
  14.     server_tokens                   off;
  15.     gzip                            on;
  16.     gzip_comp_level                 5;
  17.     gzip_min_length                 256;
  18.     gzip_proxied                    any;
  19.  
  20.     server {
  21.         listen                      80;
  22.         server_name                 example.com 192.168.2.81;
  23.         return                      301 https://$server_name$request_uri;
  24.        
  25.         error_page                  500 502 503 504 /50x.html;
  26.         location =  /50x.html {
  27.             root                    html;
  28.         }
  29.         access_log                  /nginx/logs/example.com-http-access.log;
  30.         error_log                   /nginx/logs/example.com-http-error.log;
  31.     }
  32.  
  33.     server {
  34.         listen                      8443 ssl http2;
  35.         listen                      443 ssl http2;
  36.         server_name                 example.com 192.168.2.81;
  37.  
  38.         include                     ssl.conf;
  39.         include                     services.conf;
  40.         include                     php.conf;
  41.        
  42.        
  43.        
  44. ##      Send header to tell the browser to prefer https to http traffic
  45.         add_header Strict-Transport-Security    max-age=31536000;
  46.        
  47.         error_page                  500 502 503 504 /50x.html;
  48.         location =  /50x.html {
  49.             root                    html;
  50.         }
  51.         access_log                  /nginx/logs/example.com-https-access.log;
  52.         error_log                   /nginx/logs/example.com-https-error.log;
  53.     }
  54. }
  55.  
  56. # built using help and examples from https://www.redelijkheid.com/blog/2017/1/29/configure-nginx-as-a-secure-reverse-proxy and https://bjornjohansen.no/optimizing-https-nginx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement