Advertisement
monochromec

nginx.conf

Feb 16th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. server {
  2. include mime.types;
  3. default_type application/octet-stream;
  4. listen 443 ssl default_server;
  5. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  6. # ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
  7. ssl_prefer_server_ciphers on;
  8. ssl_dhparam /etc/ssl/dhparams.pem;
  9. server_name XXX.XXX.XXX.XXX;
  10. ssl_trusted_certificate /etc/letsencrypt/live/XXX.XXX.XXX.XXX/chain.pem;
  11. # ssl_certificate /etc/ssl/sfcacert.pem;
  12. # path to your cacert.pem
  13. ssl_certificate /etc/letsencrypt/live/XXX.XXX.XXX.XXX/fullchain.pem;
  14. # path to your cacert.pem
  15. ssl_certificate_key /etc/letsencrypt/live/XXX.XXX.XXX.XXX/privkey.pem;
  16. # ssl_certificate_key /etc/ssl/sfprivkey.pem;
  17. # path to your privkey.pem
  18. # Add headers to serve security related headers
  19. add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
  20. add_header X-Content-Type-Options nosniff;
  21. add_header X-Frame-Options "SAMEORIGIN";
  22. add_header X-XSS-Protection "1; mode=block";
  23. add_header X-Robots-Tag none;
  24. add_header X-Download-Options noopen;
  25. add_header X-Permitted-Cross-Domain-Policies none;
  26. # Path to the root of your installation
  27. # root /opt/owncloud;
  28. root /usr/share/webapps/owncloud/;
  29. # set max upload size
  30. client_max_body_size 4G;
  31. fastcgi_buffers 64 4K;
  32. # Disable gzip to avoid the removal of the ETag header
  33. gzip off;
  34. # Uncomment if your server is build with the ngx_pagespeed module
  35. # This module is currently not supported.
  36. #pagespeed off;
  37. rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
  38. rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
  39. rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
  40. index index.php;
  41. error_page 403 /core/templates/403.php;
  42. error_page 404 /core/templates/404.php;
  43. error_log /var/log/nginx/owncloud.error.log info;
  44. access_log /var/log/nginx/owncloud.access.log;
  45.  
  46. location = /robots.txt {
  47. allow all;
  48. log_not_found off;
  49. access_log off;
  50. }
  51.  
  52. location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
  53. deny all;
  54. }
  55.  
  56. location / {
  57. # The following 2 rules are only needed with webfinger
  58. # rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  59. # rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
  60. # rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
  61. # rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
  62. # rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
  63. # try_files $uri $uri/ /index.php;
  64. rewrite ^/remote/(.*) /remote.php last;
  65. rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
  66. try_files $uri $uri/ =404;
  67. }
  68.  
  69. location ~ \.php(?:$|/) {
  70. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  71. include fastcgi_params;
  72. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  73. fastcgi_param PATH_INFO $fastcgi_path_info;
  74. fastcgi_param HTTPS on;
  75. fastcgi_param modHeadersAvailable true;
  76. #Avoid sending the security headers twice
  77. # Unix domain sockets are faster than TCP sockets
  78. fastcgi_read_timeout 240s;
  79. fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
  80. fastcgi_intercept_errors on;
  81. }
  82. # Optional: set long EXPIRES header on static assets
  83.  
  84. location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
  85. expires 30d;
  86. # Optional: Don't log access to assets
  87. access_log off;
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement