diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index fd24f8b6..86f70aff 100755 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -1081,6 +1081,80 @@ then # Display Success Message echo -e "\033[34m http://$DOMAIN Domain Successfully Created \e[0m" + elif [ "$4" = "wpsc" ] + then + + # Check SITENAME Is Empty Or Not + SITENAMECHECK=$5 + EESITENAME + + # Creating Website $DOMAIN + NGINXCONF=wpsingle/wpsc.conf + EEDOMAINSETUP + + # Setup WordPress Webroot & Database + EEWPSETUP + EEWPDBSETUP + + # Installing WP Super Cache + cd /var/www/$DOMAIN/htdocs/ + wp plugin install wp-super-cache || OwnError "Unable To Install WP Super Cache Plugin" + + # Activate WP Super Cache + wp plugin activate wp-super-cache || OwnError "Unable To Activate WP Super Cache Plugin" + + # Change Webroot Permission + EEPERMISSION + + # Take Nginx Configuration In Git Version Control + EEGITDIR=/etc/nginx + EEGITMESSAGE="Created New $3 $4 Website: $DOMAIN" + EEGITCOMMIT + + # Display Success Message + echo -e "\033[34m http://$DOMAIN Domain Successfully Created \e[0m" + + elif [ "$4" = "wpfc" ] + then + + # Check SITENAME Is Empty Or Not + SITENAMECHECK=$5 + EESITENAME + + # Creating Website $DOMAIN + NGINXCONF=wpsingle/wpfc.conf + EEDOMAINSETUP + + # Setup WordPress Webroot & Database + EEWPSETUP + EEWPDBSETUP + + # Installing WordPress Plugins + cd /var/www/$DOMAIN/htdocs/ + + # Installing Nginx Helper + wp plugin install nginx-helper || OwnError "Unable To Install Nginx Helper" + + # Activate Nginx Helper + wp plugin activate nginx-helper || OwnError "Unable To Activate Nginx Helper Plugin" + + # Installing W3 Total Cache + wp plugin install w3-total-cache || OwnError "Unable To Install W3 Total Cache Plugin" + + # Activate W3 Total Cache + wp plugin activate w3-total-cache || OwnError "Unable To Activate W3 Total Cache Plugin" + + # Change Webroot Permission + EEPERMISSION + + # Take Nginx Configuration In Git Version Control + EEGITDIR=/etc/nginx + EEGITMESSAGE="Created New $3 $4 Website: $DOMAIN" + EEGITCOMMIT + + # Display Success Message + echo -e "\033[34m http://$DOMAIN Domain Successfully Created \e[0m" + fi fi diff --git a/usr/share/easyengine/nginx/wpsingle/fastcgi-cache.conf b/usr/share/easyengine/nginx/wpsingle/fastcgi-cache.conf deleted file mode 100644 index 4a67ce99..00000000 --- a/usr/share/easyengine/nginx/wpsingle/fastcgi-cache.conf +++ /dev/null @@ -1,63 +0,0 @@ -#move next 3 lines to /etc/nginx/nginx.conf if you want to use fastcgi_cache across many sites -fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:500m inactive=60m; -fastcgi_cache_key "$scheme$request_method$host$request_uri"; -fastcgi_cache_use_stale error timeout invalid_header http_500; - -server { - server_name example.com www.example.com; - - access_log /var/log/nginx/example.com.access.log; - error_log /var/log/nginx/example.com.error.log; - - root /var/www/example.com/htdocs; - index index.php; - - set $no_cache 0; - - # POST requests and urls with a query string should always go to PHP - if ($request_method = POST) { - set $no_cache 1; - } - if ($query_string != "") { - set $no_cache 1; - } - - # Don't cache uris containing the following segments - if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { - set $no_cache 1; - } - - # Don't use the cache for logged in users or recent commenters - if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { - set $no_cache 1; - } - - location / { - try_files $uri $uri/ /index.php?$args; - } - - location ~ .php$ { - try_files $uri /index.php; - include fastcgi_params; - #fastcgi_pass 127.0.0.1:9000; - fastcgi_pass unix:/var/run/php5-fpm.sock; - - fastcgi_cache_bypass $no_cache; - fastcgi_no_cache $no_cache; - - fastcgi_cache WORDPRESS; - fastcgi_cache_valid 60m; - } - - location ~ /purge(/.*) { - fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; - } - - location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { - access_log off; log_not_found off; expires max; - } - - location = /favicon.php { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - location ~ /\. { deny all; access_log off; log_not_found off; } -} diff --git a/usr/share/easyengine/nginx/wpsingle/w3tc.conf b/usr/share/easyengine/nginx/wpsingle/w3tc.conf index 055630de..03942b1c 100644 --- a/usr/share/easyengine/nginx/wpsingle/w3tc.conf +++ b/usr/share/easyengine/nginx/wpsingle/w3tc.conf @@ -34,6 +34,10 @@ server { try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args; } + location ~ ^/wp-content/cache/minify/[^/]+/(.*)$ { + try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; + } + location ~ .php$ { try_files $uri /index.php; include fastcgi_params; diff --git a/usr/share/easyengine/nginx/wpsingle/wpfc.conf b/usr/share/easyengine/nginx/wpsingle/wpfc.conf new file mode 100644 index 00000000..c9381388 --- /dev/null +++ b/usr/share/easyengine/nginx/wpsingle/wpfc.conf @@ -0,0 +1,54 @@ +server { + + server_name example.com www.example.com; + + access_log /var/log/nginx/example.com.access.log; + error_log /var/log/nginx/example.com.error.log; + + root /var/www/example.com/htdocs; + index index.php index.htm index.html; + + set $skip_cache 0; + + # POST Requests And Urls With A Query String Should Always Go To PHP + if ($request_method = POST) { + set $skip_cache 1; + } + + if ($query_string != "") { + set $skip_cache 1; + } + + # Don't Cache Uris Containing The Following Segments + if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { + set $skip_cache 1; + } + + # Don't Use The Cache For Logged In Users Or Recent Commenters + if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { + set $skip_cache 1; + } + + # Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ .php$ { + try_files $uri /index.php; + include fastcgi_params; + fastcgi_pass php; + + fastcgi_cache_bypass $skip_cache; + fastcgi_no_cache $skip_cache; + + fastcgi_cache WORDPRESS; + fastcgi_cache_valid 60m; + } + + location ~ /purge(/.*) { + fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; + } + + include /etc/nginx/common/locations.conf; +} diff --git a/usr/share/easyengine/nginx/wpsingle/wp-super-cache.conf b/usr/share/easyengine/nginx/wpsingle/wpsc.conf similarity index 55% rename from usr/share/easyengine/nginx/wpsingle/wp-super-cache.conf rename to usr/share/easyengine/nginx/wpsingle/wpsc.conf index ab2d2dc4..b776ea83 100644 --- a/usr/share/easyengine/nginx/wpsingle/wp-super-cache.conf +++ b/usr/share/easyengine/nginx/wpsingle/wpsc.conf @@ -1,4 +1,5 @@ server { + server_name example.com www.example.com; access_log /var/log/nginx/example.com.access.log; @@ -9,41 +10,35 @@ server { set $cache_uri $request_uri; - # POST requests and urls with a query string should always go to PHP + # POST Requests And Urls With A Query String Should Always Go To PHP if ($request_method = POST) { set $cache_uri 'null cache'; - } + } + if ($query_string != "") { set $cache_uri 'null cache'; } - # Don't cache uris containing the following segments + # Don't Cache Uris Containing The Following Segments if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { set $cache_uri 'null cache'; } - # Don't use the cache for logged in users or recent commenters + # Don't Use The Cache For Logged In Users Or Recent Commenters if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { set $cache_uri 'null cache'; } - # Use cached or actual file if they exists, otherwise pass request to WordPress + # Use Cached Or Actual File If They Exists, Otherwise Pass Request To WordPress location / { - try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args; + try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php; } - location = /favicon.ico { log_not_found off; access_log off; } - location = /robots.txt { log_not_found off; access_log off; } - location ~ .php$ { try_files $uri /index.php; include fastcgi_params; - #fastcgi_pass 127.0.0.1:9000; - fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_pass php; } - # Cache static files for as long as possible - location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { - expires max; log_not_found off; access_log off; - } + include /etc/nginx/common/locations.conf; }