Advertisement
MertcanGokgoz

Untitled

Jan 11th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. server {
  2. listen 443 ssl http2;
  3. listen [::]:443 ssl http2;
  4.  
  5. server_name example.com;
  6. set $base /var/www/example.com;
  7. root $base/public;
  8.  
  9. # SSL
  10. ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  11. ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
  12. ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  13.  
  14. # index.php
  15. index index.php;
  16.  
  17. # index.php fallback
  18. location / {
  19. try_files $uri $uri/ /index.php?$query_string;
  20. }
  21. }
  22.  
  23. # subdomains redirect
  24. server {
  25. listen 443 ssl http2;
  26. listen [::]:443 ssl http2;
  27.  
  28. server_name *.example.com;
  29.  
  30. # SSL
  31. ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  32. ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
  33. ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  34.  
  35. return 301 https://example.com$request_uri;
  36. }
  37.  
  38. # HTTP redirect
  39. server {
  40. listen 80;
  41. listen [::]:80;
  42.  
  43. server_name .example.com;
  44.  
  45. location / {
  46. return 301 https://example.com$request_uri;
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement