Skip to content
Snippets Groups Projects

Perf nginx

Closed Ismael Posada Trobo requested to merge perf-nginx into master
1 unresolved thread
7 files
+ 509
218
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -2,6 +2,8 @@ upstream php {
server unix:/var/run/drupal.sock;
}
#proxy_cache_path /var/cache/nginx keys_zone=one:10m max_size=200m;
server {
#listen 8080 ssl;
listen 8080;
@@ -12,10 +14,35 @@ server {
#ssl_session_timeout 4h;
root /var/run/app/web;
# Add gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_comp_level 5;
gzip_types application/json text/css text/javascript application/x-javascript application/javascript image/svg+xml;
gzip_proxied any;
sendfile on;
keepalive_timeout 25;
etag off;
# Disables specifying the port in absolute redirects
port_in_redirect off;
location / {
# try_files $uri @rewrite; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
# https://drupal.stackexchange.com/questions/192151/cannot-install-any-theme
rewrite ^/core/authorize.php/core/authorize.php(.*)$ /core/authorize.php$1;
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location = /favicon.ico {
log_not_found off;
access_log off;
@@ -39,10 +66,8 @@ server {
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
}
# https://drupal.stackexchange.com/questions/192151/cannot-install-any-theme
rewrite ^/core/authorize.php/core/authorize.php(.*)$ /core/authorize.php$1;
location ~ \..*/.*\.php$ {
return 403;
}
@@ -66,16 +91,7 @@ server {
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}
location / {
# try_files $uri @rewrite; # For Drupal <= 6
try_files $uri /index.php?$query_string; # For Drupal >= 7
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
}
# Don't allow direct access to PHP files in the vendor directory.
location ~ /vendor/.*\.php$ {
@@ -127,23 +143,10 @@ server {
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri @rewrite;
expires max;
access_log off;
log_not_found off;
}
location ^~ /simplesaml {
alias /app/vendor/simplesamlphp/simplesamlphp/www;
location ~ ^(?<prefix>/simplesaml)(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ {
include fastcgi_params;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+?\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$phpfile;
fastcgi_param PATH_INFO $pathinfo if_not_empty;
}
}
# We want to make the redirection https://sitename.web.cern.ch/sitename/sites/something to https://sitename.web.cern.ch/sites/default/.
# This location matches any url containing /sites/sitename/.../file and redirects to /sites/default/.../file.
# It omits redirection for urls containing /sites/default.
Loading