From 529b8db317b8d1bc58dc0601780bf6165ef2cb5f Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Mon, 2 Sep 2013 12:10:54 +0530 Subject: [PATCH] Remove WordPress Settings From Locations.conf and Change Shared Folder Settings --- etc/nginx/common/locations.conf | 54 +++++++------------ usr/share/easyengine/nginx/wp/basic.conf | 8 +++ usr/share/easyengine/nginx/wp/w3tc.conf | 8 +++ usr/share/easyengine/nginx/wp/wpfc.conf | 8 +++ usr/share/easyengine/nginx/wp/wpsc.conf | 8 +++ .../easyengine/nginx/wpsubdir/basic.conf | 8 +++ usr/share/easyengine/nginx/wpsubdir/w3tc.conf | 8 +++ usr/share/easyengine/nginx/wpsubdir/wpfc.conf | 8 +++ usr/share/easyengine/nginx/wpsubdir/wpsc.conf | 8 +++ .../easyengine/nginx/wpsubdomain/basic.conf | 8 +++ .../easyengine/nginx/wpsubdomain/w3tc.conf | 8 +++ .../easyengine/nginx/wpsubdomain/wpfc.conf | 8 +++ .../easyengine/nginx/wpsubdomain/wpsc.conf | 8 +++ 13 files changed, 114 insertions(+), 36 deletions(-) diff --git a/etc/nginx/common/locations.conf b/etc/nginx/common/locations.conf index 43839373..84cf1963 100644 --- a/etc/nginx/common/locations.conf +++ b/etc/nginx/common/locations.conf @@ -20,48 +20,38 @@ location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif expires max; } -# PMA Settings -location /pma { - root /var/www/shared; + +# EasyEngine Shared Settings +location /ee { + autoindex on; + alias /var/www/shared/; + include common/allowed_ip.conf; index index.php index.html index.htm; - location ~ ^/pma/(.+\.php)$ { - try_files $uri =404; - root /var/www/shared; + location ~ ^/ee(.+\.php)$ { + alias /var/www/shared$1; fastcgi_pass php; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } - location ~* ^/pma/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { - root /var/www/shared; + location ~* ^/ee(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { + alias /var/www/shared$1; } } +# PMA Settings +location /pma { + rewrite ^/* /ee/pma last; +} + location /phpMyAdmin { - rewrite ^/* /pma last; + rewrite ^/* /ee/pma last; } location /phpmyadmin { - rewrite ^/* /pma last; + rewrite ^/* /ee/pma last; } -# Opcahe Pages -location /opcache { - root /var/www/shared; - include common/allowed_ip.conf; - index index.php index.html index.htm; - - location ~ ^/opcache/(.+\.php)$ { - try_files $uri =404; - root /var/www/shared; - fastcgi_pass php; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include /etc/nginx/fastcgi_params; - } -} # Status Pages location /nginx_status { @@ -76,6 +66,7 @@ location ~ ^/(status|ping) { include common/allowed_ip.conf; } + # Security Settings For Better Privacy location ~ /\. { @@ -95,12 +86,3 @@ location ~ /readme\.(txt|html)$ { access_log off; log_not_found off; } - -# Disallow PHP In Upload Folder -location /wp-content/uploads/ { - - location ~ \.php$ { - #Prevent Direct Access Of PHP Files From Web Browsers - deny all; - } -} \ No newline at end of file diff --git a/usr/share/easyengine/nginx/wp/basic.conf b/usr/share/easyengine/nginx/wp/basic.conf index a386e24d..2a5948e8 100644 --- a/usr/share/easyengine/nginx/wp/basic.conf +++ b/usr/share/easyengine/nginx/wp/basic.conf @@ -19,6 +19,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wp/w3tc.conf b/usr/share/easyengine/nginx/wp/w3tc.conf index b59e21cd..40301a88 100644 --- a/usr/share/easyengine/nginx/wp/w3tc.conf +++ b/usr/share/easyengine/nginx/wp/w3tc.conf @@ -45,6 +45,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wp/wpfc.conf b/usr/share/easyengine/nginx/wp/wpfc.conf index f253708a..e6e47742 100644 --- a/usr/share/easyengine/nginx/wp/wpfc.conf +++ b/usr/share/easyengine/nginx/wp/wpfc.conf @@ -51,5 +51,13 @@ server { fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wp/wpsc.conf b/usr/share/easyengine/nginx/wp/wpsc.conf index 38158e5d..1394d282 100644 --- a/usr/share/easyengine/nginx/wp/wpsc.conf +++ b/usr/share/easyengine/nginx/wp/wpsc.conf @@ -41,5 +41,13 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdir/basic.conf b/usr/share/easyengine/nginx/wpsubdir/basic.conf index ddf3ea95..dfea1735 100644 --- a/usr/share/easyengine/nginx/wpsubdir/basic.conf +++ b/usr/share/easyengine/nginx/wpsubdir/basic.conf @@ -37,6 +37,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdir/w3tc.conf b/usr/share/easyengine/nginx/wpsubdir/w3tc.conf index 5284d403..b0efa263 100644 --- a/usr/share/easyengine/nginx/wpsubdir/w3tc.conf +++ b/usr/share/easyengine/nginx/wpsubdir/w3tc.conf @@ -59,6 +59,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdir/wpfc.conf b/usr/share/easyengine/nginx/wpsubdir/wpfc.conf index b443df65..9f8b22cc 100644 --- a/usr/share/easyengine/nginx/wpsubdir/wpfc.conf +++ b/usr/share/easyengine/nginx/wpsubdir/wpfc.conf @@ -69,5 +69,13 @@ server { fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdir/wpsc.conf b/usr/share/easyengine/nginx/wpsubdir/wpsc.conf index 19930495..3bd81dd5 100644 --- a/usr/share/easyengine/nginx/wpsubdir/wpsc.conf +++ b/usr/share/easyengine/nginx/wpsubdir/wpsc.conf @@ -59,6 +59,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdomain/basic.conf b/usr/share/easyengine/nginx/wpsubdomain/basic.conf index f15dc822..9bc14eed 100644 --- a/usr/share/easyengine/nginx/wpsubdomain/basic.conf +++ b/usr/share/easyengine/nginx/wpsubdomain/basic.conf @@ -25,6 +25,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdomain/w3tc.conf b/usr/share/easyengine/nginx/wpsubdomain/w3tc.conf index ba8bed0e..908472d2 100644 --- a/usr/share/easyengine/nginx/wpsubdomain/w3tc.conf +++ b/usr/share/easyengine/nginx/wpsubdomain/w3tc.conf @@ -47,6 +47,14 @@ server { fastcgi_pass php; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdomain/wpfc.conf b/usr/share/easyengine/nginx/wpsubdomain/wpfc.conf index 64318c53..d151a26a 100644 --- a/usr/share/easyengine/nginx/wpsubdomain/wpfc.conf +++ b/usr/share/easyengine/nginx/wpsubdomain/wpfc.conf @@ -57,5 +57,13 @@ server { fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; } diff --git a/usr/share/easyengine/nginx/wpsubdomain/wpsc.conf b/usr/share/easyengine/nginx/wpsubdomain/wpsc.conf index 0dc4e001..ef1fdbb4 100644 --- a/usr/share/easyengine/nginx/wpsubdomain/wpsc.conf +++ b/usr/share/easyengine/nginx/wpsubdomain/wpsc.conf @@ -50,6 +50,14 @@ server { fastcgi_param SERVER_NAME $http_host; } + # Disallow PHP In Upload Folder + location /wp-content/uploads/ { + location ~ \.php$ { + #Prevent Direct Access Of PHP Files From Web Browsers + deny all; + } + } + include /etc/nginx/common/locations.conf; }