Advertisement
vinzlee

sites-availableAfterSSL

Dec 13th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. server
  2. {
  3. listen 443 ssl http2;
  4. listen [::]:443 ssl http2;
  5.  
  6. root /var/www/html/mywebsite;
  7. index index.php index.html index.htm index.nginx-debian.html;
  8.  
  9. server_name mywebsite.com www.mywebsite.com;
  10.  
  11. location /
  12. {
  13. try_files $uri $uri/ /index.html;
  14. }
  15.  
  16. location ~ \.php$
  17. {
  18. try_files $uri = 404;
  19. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  20. fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
  21. fastcgi_index index.php;
  22. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  23. include fastcgi_params;
  24. }
  25.  
  26. ssl_certificate /etc/letsencrypt/live/mywebsite.com/fullchain.pem; # managed by Certbot
  27. ssl_certificate_key /etc/letsencrypt/live/mywebsite.com/privkey.pem; # managed by Certbot
  28.  
  29. }
  30. server
  31. {
  32. if ($host = www.mywebsite.com) {
  33. return 301 https://$host$request_uri;
  34. } # managed by Certbot
  35.  
  36.  
  37. if ($host = mywebsite.com) {
  38. return 301 https://$host$request_uri;
  39. } # managed by Certbot
  40.  
  41.  
  42. listen 80;
  43. listen [::]:80;
  44.  
  45. server_name mywebsite.com www.mywebsite.com;
  46. return 404; # managed by Certbot
  47.  
  48.  
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement