Advertisement
mkoflerAT

nginx-letsencrypt-template-2nd

Dec 10th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.09 KB | None | 0 0
  1. server {
  2.         # listen 80 default_server;
  3.         # listen [::]:80 default_server;
  4.         listen 80;
  5.         server_name xyz.com;
  6.         return 301 https://www.xyz.com$request_uri;
  7. }
  8.  
  9. server {
  10.         # listen 80 default_server;
  11.         # listen [::]:80 default_server;
  12.  
  13.         ### ===== added for lets-encrypt-support =====
  14.         location ~ /.well-known {
  15.                 allow all;
  16.         }
  17.  
  18.         ### ===== adjusted servername / webroot =====
  19.         server_name xyz.com www.xyz.com;
  20.         root /var/www/xyz.com/html;
  21.  
  22.         ### ===== SSL configuration =====
  23.         listen 443 ssl http2 default_server;
  24.         listen [::]:443 ssl http2 default_server;
  25.         include snippets/ssl-xyz.com.conf;
  26.         include snippets/ssl-params.conf;
  27.  
  28.         # Add index.php to the list if you are using PHP
  29.         index index.html index.htm index.nginx-debian.html;
  30.  
  31.         location / {
  32.                 # First attempt to serve request as file, then
  33.                 # as directory, then fall back to displaying a 404.
  34.                 try_files $uri $uri/ =404;
  35.         }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement