Results 1 to 11 of 11
Thread: Webuzo + Nginx + cache plugins
-
10-15-2013, 12:18 PM #1Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
Webuzo + Nginx + cache plugins
Hello guys,
I'm planing to use Webuzo on my new VPS server.
I just installed a clean install on CentOS 6.4 and activated the free 15 days trial, then i installed LEMP stack and wordpress.
Every thing seems to work fine, but my problem that i couldn't get any cache plugins to work with Nginx, i tried w3 total cache, wp super cache with no success.
"Enable compression" and "Leverage browser caching" are always red and page speed around 50-60 /100.
I tried to configure "/usr/local/apps/nginx/etc/conf.d/common" and "/usr/local/apps/nginx/etc/conf.d/webuzoVH.conf" but it doesn't work at all.
Please any advise?
Thanks!
-
10-15-2013, 01:31 PM #2Junior Guru
- Join Date
- Feb 2012
- Posts
- 231
You can try the following article:
http://codex.wordpress.org/Nginx
Also, did you restart the NGINX service for the changes to take effect ?WEBUZO - Single User Control Panel for your VPS/Cloud/Server (CentOS/Ubuntu)
Install NGINX, Apache, MySQL, LAMP, LEMP, PHP, Java and 310+ popular scripts by a CLICK
Email Server, Database Management, Domain Management, FTP Management, CSF, CRON
-
10-15-2013, 02:22 PM #3Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
Thank you, actually I've tried this article but i found it really complicated.
Also i couldn't find the main ".conf" path because webuzo uses different paths.
and sure i do restart the NGINX after any changes.
-
10-16-2013, 12:45 AM #4Junior Guru
- Join Date
- Feb 2012
- Posts
- 231
WEBUZO - Single User Control Panel for your VPS/Cloud/Server (CentOS/Ubuntu)
Install NGINX, Apache, MySQL, LAMP, LEMP, PHP, Java and 310+ popular scripts by a CLICK
Email Server, Database Management, Domain Management, FTP Management, CSF, CRON
-
10-16-2013, 01:48 AM #5Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
Thank you for the answer. but this is my first experience with vps and nginx, so I'm totally newbie.
There are many "sections" inside the "common" file so i get confused.
I tried to add "try_files $uri $uri/ /index.php?q=$uri;"
atPHP Code:# Pass the INDEX.PHP script to FastCGI server listening on 127.0.0.1:9178
location = / {
fastcgi_read_timeout 3600;
try_files $uri $uri/ /index.php?q=$uri;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
Thanks a lot.
-
10-16-2013, 06:14 AM #6Junior Guru
- Join Date
- Feb 2012
- Posts
- 231
You can follow this guide to learn the basics of NGINX configuration and proceed with your changes accordingly.
https://library.linode.com/web-serve...guration/basic
This line serves requests at the document root. Did you install your script at the root of a domain or a sub-directory ?
If NO, then you are adding the configuration at the wrong line.WEBUZO - Single User Control Panel for your VPS/Cloud/Server (CentOS/Ubuntu)
Install NGINX, Apache, MySQL, LAMP, LEMP, PHP, Java and 310+ popular scripts by a CLICK
Email Server, Database Management, Domain Management, FTP Management, CSF, CRON
-
10-16-2013, 11:56 AM #7Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
Finally It works! Thank you very much!
-
10-16-2013, 12:03 PM #8Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
lol i need 1 more post to add links
because i like to share the solution.
-
10-16-2013, 12:09 PM #9Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
Now my page speed is 95/100!!
Here is the solution:
I've added this code to "/usr/local/apps/nginx/etc/conf.d/webuzoVH.conf" (change site.com with your domain or ip)
PHP Code:server {
rewrite ^(.*) http://site.com$1 permanent;
}
# Define default caching of 1 week
expires 31536000s;
add_header Pragma public;
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
PHP Code:# Use gzip compression
# gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_buffers 16 8k;
gzip_http_version 1.0;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg;
# Rewrite minified CSS and JS files
location ~* .(css|js) {
if (!-f $request_filename) {
rewrite ^/wp-content/w3tc/min/(.+.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last;
# Use the following line instead for versions of W3TC pre-0.9.2.2
# rewrite ^/wp-content/w3tc/min/([a-f0-9]+)/(.+).(include(-(footer|body))?(-nb)?).[0-9]+.(css|js)$ /wp-content/w3tc/min/index.php?tt=$1&gg=$2&g=$3&t=$7 last;
}
}
# Set a variable to work around the lack of nested conditionals
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'no cache';
}
if ($query_string != "") {
set $cache_uri 'no cache';
}
# Don't cache uris containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php)") {
set $cache_uri "no cache";
}
# 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 'no cache';
}
# Use cached or actual file if they exists, otherwise pass request to WordPress
location / {
try_files /wp-content/w3tc/pgcache/$cache_uri/_index.html $uri $uri/ /index.php?q=$uri&$args;
}
# Cache static files for as long as possible
location ~* .(xml|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)$ {
try_files $uri =404;
expires max;
access_log off;
}
# Deny access to hidden files
location ~* /.ht {
deny all;
access_log off;
log_not_found off;
}
Thank you again!
-
10-17-2013, 01:37 AM #10Junior Guru
- Join Date
- Feb 2012
- Posts
- 231
Sir please make sure you take a backup of the files.
The file webuzoVH.conf is rebuilt every time you add/delete a domain and other cases.
We shall have these changes reviewed and implemented by default in the upcoming version of Webuzo.WEBUZO - Single User Control Panel for your VPS/Cloud/Server (CentOS/Ubuntu)
Install NGINX, Apache, MySQL, LAMP, LEMP, PHP, Java and 310+ popular scripts by a CLICK
Email Server, Database Management, Domain Management, FTP Management, CSF, CRON
-
10-17-2013, 08:32 PM #11Newbie
- Join Date
- Oct 2013
- Location
- Giza Governorate
- Posts
- 7
Better solution
Thank you,
But i found better way to solve all "Enable compression" and "Leverage browser caching" problems with Nginx. you don't need all previous codes, even it works without any cache plugins like W3 total cache or WP super cache.
Tested on CentOS 6.4 with Webuzo installed and Ubuntu 12.04 only LEMP installed.
Step 1: add this code just after the server name line:
- If you use centos / webuzo:PHP Code:vi /usr/local/apps/nginx/etc/conf.d/webuzoVH.conf
- If you use ubuntu:PHP Code:nano /etc/nginx/sites-enabled/yoursite
PHP Code:server_name yoursite.com;
# Define default caching of 1 week
expires 31536000s;
add_header Pragma public;
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml a$
Edit or add these lines in "http {" section:
- If you use centos / webuzo: in the Enduser panel > Nginx
- If you use ubuntu:PHP Code:nano /etc/nginx/nginx.conf
PHP Code:gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 5;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
PHP Code:sudo service nginx restart
Last edited by awran5; 10-17-2013 at 08:37 PM.
Similar Threads
-
Virtualizor/Webuzo Bugs & Fixes - Webuzo 2.1.2 Expected This Weekend
By Johnny Cache in forum Hosting Software and Control PanelsReplies: 1Last Post: 07-22-2013, 07:05 AM -
WordPress Cache Plugins
By yitwail in forum Hosting Security and TechnologyReplies: 4Last Post: 02-03-2013, 04:10 PM -
Nginx Cache / Varnish Cache / Mod_Security / DDOS Specialist Wanted
By CloudStats in forum Employment / Job OffersReplies: 4Last Post: 12-25-2012, 08:26 AM -
Nginx Cache / Varnish Cache / Mod_Security / DDOS Specialist Wanted
By CloudStats in forum Employment / Job OffersReplies: 3Last Post: 12-04-2012, 01:17 AM -
WordPress PlugIns for Cache, Captcha
By Lanny in forum Web Design and ContentReplies: 9Last Post: 02-15-2011, 09:30 AM