Guest User

hilfreiche-server.tips

a guest
Nov 11th, 2016
1,236
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. server {
  3. listen 80;
  4. location / {
  5. return 301 https://$host$request_uri;
  6. }
  7. }
  8.  
  9.  
  10. server
  11. {
  12. listen 443 ssl http2 default_server;
  13. ssl on;
  14. add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
  15. ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4';
  16. ssl_prefer_server_ciphers on;
  17. ssl_session_cache shared:SSL:10m;
  18. ssl_dhparam /etc/ssl/private/dhparams.pem;
  19. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  20. ssl_certificate /etc/letsencrypt/live/deine.cloud/fullchain.pem;
  21. ssl_certificate_key /etc/letsencrypt/live/deine.cloud/privkey.pem;
  22.  
  23. root /var/www/;
  24.  
  25. # set max upload size
  26. client_max_body_size 1G;
  27. fastcgi_buffers 64 4K;
  28.  
  29. # Disable gzip to avoid the removal of the ETag header
  30. gzip off;
  31.  
  32. #error_page 403 /owncloud/core/templates/403.php;
  33. #error_page 404 /owncloud/core/templates/404.php;
  34.  
  35. location / {
  36. rewrite ^ /index.php$uri;
  37. }
  38.  
  39. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  40. deny all;
  41. }
  42.  
  43. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  44. deny all;
  45. }
  46.  
  47. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
  48. include fastcgi_params;
  49. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  50. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  51. fastcgi_param PATH_INFO $fastcgi_path_info;
  52.  
  53. # Important: disable HTTPS, otherwise no log in will be possible!
  54. #fastcgi_param HTTPS on;
  55.  
  56. fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
  57. fastcgi_param front_controller_active true;
  58. fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  59. fastcgi_intercept_errors on;
  60.  
  61. # Raise timeout values.
  62. # This is especially important when the ownCloud setup runs into timeouts (504 gateway errors)
  63. fastcgi_read_timeout 300;
  64. fastcgi_send_timeout 300;
  65. fastcgi_connect_timeout 300;
  66.  
  67. # Pass PHP variables directly to PHP.
  68. # This is usually done in the php.ini. For more flexibility, these variables are configured in the nginx config.
  69. # All the PHP parameters have to be set in one fastcgi_param. When using more 'fastcgi_param PHP_VALUE' directives, the last one will override all the others.
  70. fastcgi_param PHP_VALUE "open_basedir=/var/www:/tmp/:/var/owncloud_data:/dev/urandom
  71. upload_max_filesize = 1G
  72. post_max_size = 1G
  73. max_execution_time = 3600";
  74.  
  75.  
  76. }
  77.  
  78. location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  79. try_files $uri/ =404;
  80. index index.php;
  81. }
  82.  
  83. # Adding the cache control header for js and css files
  84. # Make sure it is BELOW the PHP block
  85. location ~* \.(?:css|js)$ {
  86. try_files $uri /index.php$uri$is_args$args;
  87.  
  88. # Optional: Don't log access to assets
  89. access_log off;
  90. }
  91.  
  92. location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
  93. try_files $uri /index.php$uri$is_args$args;
  94. # Optional: Don't log access to other assets
  95. access_log off;
  96. }
  97.  
  98. }
RAW Paste Data