|
| 1 | +include upstream; |
| 2 | + |
| 3 | +server { |
| 4 | + server_name SERVER_NAME; |
| 5 | + listen 80; |
| 6 | + |
| 7 | + root /var/www/html/web; |
| 8 | + index index.php; |
| 9 | + |
| 10 | + fastcgi_keep_conn on; |
| 11 | + fastcgi_index index.php; |
| 12 | + fastcgi_param QUERY_STRING $query_string; |
| 13 | + fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
| 14 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 15 | + |
| 16 | + location / { |
| 17 | + |
| 18 | + proxy_http_version 1.1; |
| 19 | + proxy_set_header Upgrade $http_upgrade; |
| 20 | + proxy_set_header Connection 'upgrade'; |
| 21 | + proxy_set_header Host $host; |
| 22 | + proxy_set_header X-Real-IP $remote_addr; |
| 23 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 24 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 25 | + proxy_cache_bypass $http_upgrade; |
| 26 | + |
| 27 | + location ~* /system/files/ { |
| 28 | + include fastcgi_params; |
| 29 | + fastcgi_param QUERY_STRING q=$uri&$args; |
| 30 | + fastcgi_param SCRIPT_NAME /index.php; |
| 31 | + fastcgi_param SCRIPT_FILENAME $document_root/index.php; |
| 32 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 33 | + fastcgi_hide_header 'X-Generator'; |
| 34 | + fastcgi_pass upstream; |
| 35 | + log_not_found off; |
| 36 | + } |
| 37 | + |
| 38 | + location ~* /sites/.*/files/private/ { |
| 39 | + internal; |
| 40 | + } |
| 41 | + |
| 42 | + location ~* /files/styles/ { |
| 43 | + access_log off; |
| 44 | + expires 30d; |
| 45 | + try_files $uri @drupal; |
| 46 | + } |
| 47 | + |
| 48 | + location ~* /sites/.+/files/.+\.txt { |
| 49 | + access_log off; |
| 50 | + expires 7d; |
| 51 | + tcp_nodelay off; |
| 52 | + open_file_cache max=1000 inactive=30s; |
| 53 | + open_file_cache_valid 30s; |
| 54 | + open_file_cache_min_uses 2; |
| 55 | + open_file_cache_errors off; |
| 56 | + } |
| 57 | + |
| 58 | + location ~* /sites/.*/files/advagg_css/ { |
| 59 | + expires max; |
| 60 | + add_header ETag ''; |
| 61 | + add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT'; |
| 62 | + add_header Accept-Ranges ''; |
| 63 | + location ~* /sites/.*/files/advagg_css/css[_[:alnum:]]+\.css$ { |
| 64 | + access_log off; |
| 65 | + try_files $uri @drupal; |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + location ~* /sites/.*/files/advagg_js/ { |
| 70 | + expires max; |
| 71 | + add_header ETag ''; |
| 72 | + add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT'; |
| 73 | + add_header Accept-Ranges ''; |
| 74 | + location ~* /sites/.*/files/advagg_js/js[_[:alnum:]]+\.js$ { |
| 75 | + access_log off; |
| 76 | + try_files $uri @drupal; |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | + location ~* /admin/reports/hacked/.+/diff/ { |
| 81 | + try_files $uri @drupal; |
| 82 | + } |
| 83 | + |
| 84 | + location ~* ^.+\.(?:cur|jpe?g|gif|htc|ico|png|xml|otf|ttf|eot|woff|woff2|svg)$ { |
| 85 | + access_log off; |
| 86 | + expires 30d; |
| 87 | + tcp_nodelay off; |
| 88 | + open_file_cache max=3000 inactive=120s; |
| 89 | + open_file_cache_valid 45s; |
| 90 | + open_file_cache_min_uses 2; |
| 91 | + open_file_cache_errors off; |
| 92 | + } |
| 93 | + |
| 94 | + location ~* ^.+\.(?:css|js)$ { |
| 95 | + access_log off; |
| 96 | + expires 30d; |
| 97 | + tcp_nodelay off; |
| 98 | + open_file_cache off; |
| 99 | + } |
| 100 | + |
| 101 | + location ~* ^.+\.(?:pdf|pptx?)$ { |
| 102 | + expires 30d; |
| 103 | + tcp_nodelay off; |
| 104 | + } |
| 105 | + |
| 106 | + location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ { |
| 107 | + return 404; |
| 108 | + } |
| 109 | + try_files $uri @drupal; |
| 110 | + } |
| 111 | + |
| 112 | + location @drupal { |
| 113 | + include fastcgi_params; |
| 114 | + fastcgi_param QUERY_STRING $query_string; |
| 115 | + fastcgi_param SCRIPT_NAME /index.php; |
| 116 | + fastcgi_param SCRIPT_FILENAME $document_root/index.php; |
| 117 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 118 | + fastcgi_hide_header 'X-Generator'; |
| 119 | + fastcgi_pass upstream; |
| 120 | + track_uploads uploads 60s; |
| 121 | + } |
| 122 | + |
| 123 | + location @drupal-no-args { |
| 124 | + include fastcgi_params; |
| 125 | + fastcgi_param QUERY_STRING q=$uri; |
| 126 | + fastcgi_param SCRIPT_NAME /index.php; |
| 127 | + fastcgi_param SCRIPT_FILENAME $document_root/index.php; |
| 128 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 129 | + fastcgi_hide_header 'X-Generator'; |
| 130 | + fastcgi_pass upstream; |
| 131 | + } |
| 132 | + |
| 133 | + location = /index.php { |
| 134 | + include fastcgi_params; |
| 135 | + fastcgi_param QUERY_STRING $query_string; |
| 136 | + fastcgi_param SCRIPT_NAME /index.php; |
| 137 | + fastcgi_param SCRIPT_FILENAME $document_root/index.php; |
| 138 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 139 | + fastcgi_hide_header 'X-Generator'; |
| 140 | + fastcgi_pass upstream; |
| 141 | + } |
| 142 | + |
| 143 | + location = /cron { |
| 144 | + include fastcgi_params; |
| 145 | + fastcgi_param QUERY_STRING q=$uri&$args; |
| 146 | + fastcgi_param SCRIPT_NAME /index.php; |
| 147 | + fastcgi_param SCRIPT_FILENAME $document_root/index.php; |
| 148 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 149 | + fastcgi_hide_header 'X-Generator'; |
| 150 | + fastcgi_pass upstream; |
| 151 | + } |
| 152 | + |
| 153 | + location ~* ^/update.php { |
| 154 | + include fastcgi_params; |
| 155 | + fastcgi_param QUERY_STRING $args; |
| 156 | + fastcgi_param SCRIPT_NAME /update.php; |
| 157 | + fastcgi_param SCRIPT_FILENAME $document_root/update.php; |
| 158 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 159 | + fastcgi_hide_header 'X-Generator'; |
| 160 | + fastcgi_pass upstream; |
| 161 | + } |
| 162 | + |
| 163 | + location = /core/install.php { |
| 164 | + include fastcgi_params; |
| 165 | + fastcgi_param QUERY_STRING $args; |
| 166 | + fastcgi_param SCRIPT_NAME /core/install.php; |
| 167 | + fastcgi_param SCRIPT_FILENAME $document_root/core/install.php; |
| 168 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 169 | + fastcgi_hide_header 'X-Generator'; |
| 170 | + fastcgi_pass upstream; |
| 171 | + } |
| 172 | + |
| 173 | + location ~* ^/core/authorize.php { |
| 174 | + include fastcgi_params; |
| 175 | + fastcgi_param QUERY_STRING $args; |
| 176 | + fastcgi_param SCRIPT_NAME /core/authorize.php; |
| 177 | + fastcgi_param SCRIPT_FILENAME $document_root/core/authorize.php; |
| 178 | + fastcgi_hide_header 'X-Drupal-Cache'; |
| 179 | + fastcgi_hide_header 'X-Generator'; |
| 180 | + fastcgi_pass upstream; |
| 181 | + } |
| 182 | + |
| 183 | + location ^~ /.bzr { |
| 184 | + return 404; |
| 185 | + } |
| 186 | + |
| 187 | + location ^~ /.git { |
| 188 | + return 404; |
| 189 | + } |
| 190 | + |
| 191 | + location ^~ /.hg { |
| 192 | + return 404; |
| 193 | + } |
| 194 | + |
| 195 | + location ^~ /.svn { |
| 196 | + return 404; |
| 197 | + } |
| 198 | + |
| 199 | + location ^~ /.cvs { |
| 200 | + return 404; |
| 201 | + } |
| 202 | + |
| 203 | + location ^~ /patches { |
| 204 | + return 404; |
| 205 | + } |
| 206 | + |
| 207 | + location ^~ /backup { |
| 208 | + return 404; |
| 209 | + } |
| 210 | + |
| 211 | + location = /robots.txt { |
| 212 | + access_log off; |
| 213 | + try_files $uri @drupal-no-args; |
| 214 | + } |
| 215 | + |
| 216 | + location = /rss.xml { |
| 217 | + try_files $uri @drupal-no-args; |
| 218 | + } |
| 219 | + |
| 220 | + location = /sitemap.xml { |
| 221 | + try_files $uri @drupal-no-args; |
| 222 | + } |
| 223 | + |
| 224 | + location = /favicon.ico { |
| 225 | + expires 30d; |
| 226 | + try_files /favicon.ico @empty; |
| 227 | + } |
| 228 | + |
| 229 | + location ~* ^/.well-known/ { |
| 230 | + allow all; |
| 231 | + } |
| 232 | + |
| 233 | + location @empty { |
| 234 | + expires 30d; |
| 235 | + empty_gif; |
| 236 | + } |
| 237 | + |
| 238 | + location ~* ^.+\.php$ { |
| 239 | + return 404; |
| 240 | + } |
| 241 | + |
| 242 | + location ~ (?<upload_form_uri>.*)/x-progress-id:(?<upload_id>\d*) { |
| 243 | + rewrite ^ $upload_form_uri?X-Progress-ID=$upload_id; |
| 244 | + } |
| 245 | + |
| 246 | + location ~ ^/progress$ { |
| 247 | + upload_progress_json_output; |
| 248 | + report_uploads uploads; |
| 249 | + } |
| 250 | +} |
0 commit comments