Results 1 to 11 of 11
  1. #1
    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!

  2. #2
    Join Date
    Feb 2012
    Posts
    231

    Thumbs up

    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

  3. #3
    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.

  4. #4
    Join Date
    Feb 2012
    Posts
    231
    Quote Originally Posted by awran5 View Post
    Also i couldn't find the main ".conf" path because webuzo uses different paths.
    You can modify the file "/usr/local/apps/nginx/etc/conf.d/common" to suit your requirements in case of NGINX.
    The Webuzo config file includes the above mentioned file for external NGINX rules and rewrites.
    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

  5. #5
    Join Date
    Oct 2013
    Location
    Giza Governorate
    Posts
    7
    Quote Originally Posted by valley View Post
    You can modify the file "/usr/local/apps/nginx/etc/conf.d/common" to suit your requirements in case of NGINX.
    The Webuzo config file includes the above mentioned file for external NGINX rules and rewrites.
    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;"

    at
    PHP 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;

    still doesn't work. would you please guide me to get the right code?

    Thanks a lot.

  6. #6
    Join Date
    Feb 2012
    Posts
    231
    Quote Originally Posted by awran5 View Post
    Thank you for the answer. but this is my first experience with vps and nginx, so I'm totally newbie.
    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

    Quote Originally Posted by awran5 View Post
    location = / {
    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

  7. #7
    Join Date
    Oct 2013
    Location
    Giza Governorate
    Posts
    7
    Finally It works! Thank you very much!

  8. #8
    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.

  9. #9
    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"
    and add this code to "/usr/local/apps/nginx/etc/conf.d/common"

    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;

    if some thing wrong with codes please guide
    Thank you again!

  10. #10
    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

  11. #11
    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 
    Note: as (valley) mentioned webuzoVH.conf file is rebuilt every time you add/delete a domain and other cases.

    - 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
    Step 2: make sure gzip is on

    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)”; 
    And finally restart Nginx:

    PHP Code:
    sudo service nginx restart 
    That's all, now delete your browser cache and refresh the page and your page speed result should be over 90/100

    Last edited by awran5; 10-17-2013 at 08:37 PM.

Similar Threads

  1. Virtualizor/Webuzo Bugs & Fixes - Webuzo 2.1.2 Expected This Weekend
    By Johnny Cache in forum Hosting Software and Control Panels
    Replies: 1
    Last Post: 07-22-2013, 07:05 AM
  2. WordPress Cache Plugins
    By yitwail in forum Hosting Security and Technology
    Replies: 4
    Last Post: 02-03-2013, 04:10 PM
  3. Nginx Cache / Varnish Cache / Mod_Security / DDOS Specialist Wanted
    By CloudStats in forum Employment / Job Offers
    Replies: 4
    Last Post: 12-25-2012, 08:26 AM
  4. Nginx Cache / Varnish Cache / Mod_Security / DDOS Specialist Wanted
    By CloudStats in forum Employment / Job Offers
    Replies: 3
    Last Post: 12-04-2012, 01:17 AM
  5. WordPress PlugIns for Cache, Captcha
    By Lanny in forum Web Design and Content
    Replies: 9
    Last Post: 02-15-2011, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •