You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 line
2.1KB

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. root /var/www/html;
  5. location ~ ^/.well-known/acme-challenge/(.*)$ {
  6. allow all;
  7. }
  8. #rewrite ^ https://$server_name$request_uri? permanent; # enforce https
  9. }
  10. server {
  11. listen 443 ssl;
  12. server_name localhost;
  13. ssl_certificate /etc/nginx/ssl/nextcloud.crt;
  14. ssl_certificate_key /etc/nginx/ssl/nextcloud.key;
  15. root /var/www/nextcloud;
  16. index index.php;
  17. client_max_body_size 10G; # set max upload size
  18. fastcgi_buffers 64 4K;
  19. rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
  20. rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
  21. rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
  22. error_page 403 = /core/templates/403.php;
  23. error_page 404 = /core/templates/404.php;
  24. location = /robots.txt {
  25. allow all;
  26. log_not_found off;
  27. access_log off;
  28. }
  29. location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
  30. deny all;
  31. }
  32. location / {
  33. rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  34. rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
  35. rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
  36. rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
  37. rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
  38. try_files $uri $uri/ index.php;
  39. }
  40. location ~ ^(.+?\.php)(/.*)?$ {
  41. try_files $1 = 404;
  42. include fastcgi_params;
  43. fastcgi_param SCRIPT_FILENAME $document_root$1;
  44. fastcgi_param PATH_INFO $2;
  45. fastcgi_param HTTPS on;
  46. fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  47. }
  48. location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
  49. expires 30d;
  50. # Optional: Don't log access to assets
  51. access_log off;
  52. }
  53. location ~ \.php$ {
  54. try_files $uri =404;
  55. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  56. fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  57. fastcgi_index index.php;
  58. include fastcgi_params;
  59. }
  60. location ~ /\.ht {
  61. deny all;
  62. }
  63. }