Advertisement
Guest User

Untitled

a guest
Sep 9th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.27 KB | None | 0 0
  1.  
  2.  
  3. server {
  4.     listen 443 ssl http2;
  5.     listen [::]:443 ssl http2;
  6.  
  7.     server_name example.com;
  8.     set $base /var/www/example.com;
  9.     root $base/public;
  10.  
  11.     # SSL
  12.     ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  13.     ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
  14.     ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
  15.  
  16.     # security
  17.     include nginxconfig.io/security.conf;
  18.  
  19.     # index.php
  20.     index index.php;
  21.  
  22.     # index.php fallback
  23.     location / {
  24.         try_files $uri $uri/ /index.php?$query_string;
  25.     }
  26.  
  27.     # handle .php
  28.     location ~ \.php$ {
  29.         include nginxconfig.io/php_fastcgi.conf;
  30.     }
  31.  
  32.     # additional config
  33.     include nginxconfig.io/general.conf;
  34. }
  35.  
  36. # subdomains redirect
  37. server {
  38.     listen 443 ssl http2;
  39.     listen [::]:443 ssl http2;
  40.  
  41.     server_name *.example.com;
  42.  
  43.     # SSL
  44.     ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  45.     ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
  46.     ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
  47.  
  48.     return 301 https://example.com$request_uri;
  49. }
  50.  
  51. # HTTP redirect
  52. server {
  53.     listen 80;
  54.     listen [::]:80;
  55.  
  56.     server_name .example.com;
  57.  
  58.     include nginxconfig.io/letsencrypt.conf;
  59.  
  60.     location / {
  61.         return 301 https://example.com$request_uri;
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement