From 101cfc2ae22764ef2222337d3472eebebba280dc Mon Sep 17 00:00:00 2001 From: frju365 Date: Wed, 18 Jan 2017 11:22:49 +0100 Subject: [PATCH] Create nginx.conf --- conf/nginx.conf | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 conf/nginx.conf diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..2c5bf5b --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,76 @@ +location ^~ YNH_WWW_PATH { + root /var/www; + try_files $uri $uri/ /YNH_WWW_APP/index.php?$query_string; + index /YNH_WWW_APP/index.php; + + location YNH_WWW_PATH/ { try_files $uri $uri/ /YNH_WWW_APP/index.php?$query_string; } + location YNH_WWW_PATH/api { try_files $uri $uri/ /YNH_WWW_APP/api.php?$query_string; } + location YNH_WWW_PATH/admin { try_files $uri $uri/ /YNH_WWW_APP/admin.php?$query_string; } + + location YNH_WWW_PATH/flarum { + deny all; + return 404; + } + + location ~* \.php$ { + fastcgi_split_path_info ^(.+.php)(/.+)$; + fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/var/run/php5-fpm-YNH_WWW_APP.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTP_PROXY ""; # Fix for https://httpoxy.org/ vulnerability + fastcgi_index yellow.php; + fastcgi_read_timeout 600; + } + + location ~* \.html$ { + expires -1; + } + + location ~* \.(css|js|gif|jpe?g|png)$ { + expires 1M; + add_header Pragma public; + add_header Cache-Control "public, must-revalidate, proxy-revalidate"; + } + location /cache { + rewrite ^(.*)$ /error break; + } + + location /content { + rewrite ^(.*)$ /error break; + } + location / { + if (!-e $request_filename) { + rewrite ^/(.*)$ /yellow.php last; + break; + } + } + location /system { + rewrite ^(.*)$ /error break; + } + gzip on; + gzip_http_version 1.1; + gzip_vary on; + gzip_comp_level 6; + gzip_proxied any; + gzip_types application/atom+xml + application/javascript + application/json + application/vnd.ms-fontobject + application/x-font-ttf + application/x-web-app-manifest+json + application/xhtml+xml + application/xml + font/opentype + image/svg+xml + image/x-icon + text/css + text/plain + text/xml; + gzip_buffers 16 8k; + gzip_disable "MSIE [1-6]\.(?!.*SV1)"; + + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +}