Advertisement
Guest User

Untitled

a guest
Jul 10th, 2021
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. worker_processes auto;
  2.  
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5.  
  6.  
  7. events {
  8. worker_connections 1024;
  9. }
  10.  
  11.  
  12. http {
  13. include /etc/nginx/mime.types;
  14. default_type application/octet-stream;
  15.  
  16. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  17. '$status $body_bytes_sent "$http_referer" '
  18. '"$http_user_agent" "$http_x_forwarded_for"';
  19.  
  20. access_log /var/log/nginx/access.log main;
  21.  
  22. sendfile on;
  23. #tcp_nopush on;
  24.  
  25. keepalive_timeout 65;
  26.  
  27. #gzip on;
  28.  
  29. upstream php-handler {
  30. server app:9000;
  31. }
  32.  
  33. server {
  34. listen 80;
  35.  
  36. # Add headers to serve security related headers
  37. # Before enabling Strict-Transport-Security headers please read into this
  38. # topic first.
  39. #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
  40. #
  41. # WARNING: Only add the preload option once you read about
  42. # the consequences in https://hstspreload.org/. This option
  43. # will add the domain to a hardcoded list that is shipped
  44. # in all major browsers and getting removed from this list
  45. # could take several months.
  46. add_header Referrer-Policy "no-referrer" always;
  47. add_header X-Content-Type-Options "nosniff" always;
  48. add_header X-Download-Options "noopen" always;
  49. add_header X-Frame-Options "SAMEORIGIN" always;
  50. add_header X-Permitted-Cross-Domain-Policies "none" always;
  51. add_header X-Robots-Tag "none" always;
  52. add_header X-XSS-Protection "1; mode=block" always;
  53.  
  54. # Remove X-Powered-By, which is an information leak
  55. fastcgi_hide_header X-Powered-By;
  56.  
  57. # Path to the root of your installation
  58. root /var/www/html;
  59.  
  60. location = /robots.txt {
  61. allow all;
  62. log_not_found off;
  63. access_log off;
  64. }
  65.  
  66. # The following 2 rules are only needed for the user_webfinger app.
  67. # Uncomment it if you're planning to use this app.
  68. #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  69. #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
  70.  
  71. # The following rule is only needed for the Social app.
  72. # Uncomment it if you're planning to use this app.
  73. #rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
  74.  
  75. location = /.well-known/carddav {
  76. return 301 $scheme://$host:$server_port/remote.php/dav;
  77. }
  78.  
  79. location = /.well-known/caldav {
  80. return 301 $scheme://$host:$server_port/remote.php/dav;
  81. }
  82.  
  83. # set max upload size
  84. client_max_body_size 10G;
  85. fastcgi_buffers 64 4K;
  86.  
  87. # Enable gzip but do not remove ETag headers
  88. gzip on;
  89. gzip_vary on;
  90. gzip_comp_level 4;
  91. gzip_min_length 256;
  92. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  93. gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
  94.  
  95. # Uncomment if your server is build with the ngx_pagespeed module
  96. # This module is currently not supported.
  97. #pagespeed off;
  98.  
  99. location / {
  100. rewrite ^ /index.php;
  101. }
  102.  
  103. location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
  104. deny all;
  105. }
  106. location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
  107. deny all;
  108. }
  109.  
  110. location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
  111. fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
  112. set $path_info $fastcgi_path_info;
  113. try_files $fastcgi_script_name =404;
  114. include fastcgi_params;
  115. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  116. fastcgi_param PATH_INFO $path_info;
  117. # fastcgi_param HTTPS on;
  118.  
  119. # Avoid sending the security headers twice
  120. fastcgi_param modHeadersAvailable true;
  121.  
  122. # Enable pretty urls
  123. fastcgi_param front_controller_active true;
  124. fastcgi_pass php-handler;
  125. fastcgi_intercept_errors on;
  126. fastcgi_request_buffering off;
  127. }
  128.  
  129. location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
  130. try_files $uri/ =404;
  131. index index.php;
  132. }
  133.  
  134. # Adding the cache control header for js, css and map files
  135. # Make sure it is BELOW the PHP block
  136. location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
  137. try_files $uri /index.php$request_uri;
  138. add_header Cache-Control "public, max-age=15778463";
  139. # Add headers to serve security related headers (It is intended to
  140. # have those duplicated to the ones above)
  141. # Before enabling Strict-Transport-Security headers please read into
  142. # this topic first.
  143. #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
  144. #
  145. # WARNING: Only add the preload option once you read about
  146. # the consequences in https://hstspreload.org/. This option
  147. # will add the domain to a hardcoded list that is shipped
  148. # in all major browsers and getting removed from this list
  149. # could take several months.
  150. add_header Referrer-Policy "no-referrer" always;
  151. add_header X-Content-Type-Options "nosniff" always;
  152. add_header X-Download-Options "noopen" always;
  153. add_header X-Frame-Options "SAMEORIGIN" always;
  154. add_header X-Permitted-Cross-Domain-Policies "none" always;
  155. add_header X-Robots-Tag "none" always;
  156. add_header X-XSS-Protection "1; mode=block" always;
  157.  
  158. # Optional: Don't log access to assets
  159. access_log off;
  160. }
  161.  
  162. location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
  163. try_files $uri /index.php$request_uri;
  164. # Optional: Don't log access to other assets
  165. access_log off;
  166. }
  167. }
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement