moodle-ssl.conf 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. server_name localhost;
  5. # Redirect HTTP to HTTPS
  6. return 301 https://$host$request_uri;
  7. }
  8. server {
  9. # SSL configuration
  10. #
  11. listen 443 ssl;
  12. listen [::]:443;
  13. ssl_certificate /etc/letsencrypt/live/wiki.castanedo.es/fullchain.pem; # managed by Certbot
  14. ssl_certificate_key /etc/letsencrypt/live/wiki.castanedo.es/privkey.pem; # managed by Certbot
  15. #
  16. # Note: You should disable gzip for SSL traffic.
  17. # See: https://bugs.debian.org/773332
  18. #
  19. # Read up on ssl_ciphers to ensure a secure configuration.
  20. # See: https://bugs.debian.org/765782
  21. #
  22. # Self signed certs generated by the ssl-cert package
  23. # Don't use them in a production server!
  24. #
  25. # include snippets/snakeoil.conf;
  26. root /var/www/moodle;
  27. # Add index.php to the list if you are using PHP
  28. index index.php index.html index.htm;
  29. server_name localhost;
  30. access_log /var/log/nginx/moodle-access.log;
  31. error_log /var/log/nginx/moodle-error.log;
  32. # Activate HSTS (HTTP Strict Transport Security)
  33. # Note: reinclude if in a location a header is set
  34. include snippets/hsts.conf;
  35. # Allow favicon.ico, robots.txt, .well-known/
  36. # Deny *.txt, *.log, .*/*.php, .*, *.json, .lock, *.ht
  37. include snippets/allowed.conf;
  38. include snippets/denied.conf;
  39. location / {
  40. # First attempt to serve request as file, then
  41. # as directory, then fall back to displaying a 404.
  42. try_files $uri $uri/ =404;
  43. }
  44. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  45. #
  46. location ~ [^/]\.php(/|$) {
  47. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  48. fastcgi_index index.php;
  49. fastcgi_pass unix:/run/php/php7.2-fpm.sock;
  50. include fastcgi_params;
  51. fastcgi_param PATH_INFO $fastcgi_path_info;
  52. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  53. }
  54. }