.

De instalare WordPress pe nginx (FURLs & Cache) - VPS Biblia Pt 13

English În limba engleză (schimbã)
  • Digg
  • Twitter
  • Technorati
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • LinkedIn
  • email

Configurare VPS Unmanaged (4 Newbies) - Partea 14: Tweak nginx pentru WordPress - Destul de URL-uri & WP Super Cache

logo-uri imagine nginx WordPress

Pentru WordPress platforma de blog-ul pentru a funcţiona corect cu nginx avem nevoie pentru a optimiza configuraţia serverului web. Acest ghid va permite celor doi caching - integrarea WP Super Cache plugin - şi de a activa permalinks destul de (FURL e, curl s, tot ce!), Cu unele simple regulile de rescriere.

OK, deci sunteţi un blogger WordPress. Dacă nu sunteţi, cât mai repede pe. În caz contrar, şi doriţi nginx-suc, păstraţi-l aici.

Pentru că văd cum am iubit pe toate până pe WordPress, şi se pare că aşa este în lume şi sora ei, şi pentru că WP atotputernic TLC are nevoie de un pic de a trai fericiti cu serverul nginx, voi scrie ce se cere.

Înfiinţat un VPS Unmanaged (4 Newbies) .. Biblia VPS

În 20 de copy / paste paşi .. de la zero la erou, caseta de gol pentru a-cute ca server Linux.

Derulaţi în jos pentru indicele seria completă.

Deci, hei, vărsat la comun si Viva virtual! Hope it helps. The_guv

De ce deranjez cu WP Super Cache?

'Cos aceasta manipulează trafic intens şi accelerează site-ul tău, Buster! Pentru mai multe despre faptul că, vezi aici. În esenţă: --

  • la Digg-dovada blog-ul dvs.

În ceea ce priveşte permalinks?

Pentru a converti URI ca si cum www.xyz.com/r/default.asp?iID=HFJJLH&iPostID=JMMGD să www.xyz.com / pretty-vă rog. În esenţă: --

  • pentru utilizare
  • pentru SEO

Drăguţ.

WordPress plugin WP Super Cache & Permalinks Bundle

Dacă doriţi NUMAI permalinks, nu caching, Treci la aici.

Creaţi un nou dosar: --

sudo nano /usr/local/nginx/conf/wordpress_params.super_cache

And in there, paste:-

# if the requested file exists, return it immediately
if (-f $request_filename) {
break;
}

set $supercache_file '';
set $supercache_uri $request_uri;

if ($request_method = POST) {
set $supercache_uri '';
}

# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $supercache_uri '';
}

if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $supercache_uri '';
}

# if we haven't bypassed the cache, specify our supercache file
if ($supercache_uri ~ ^(.+)$) {
set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
}

# only rewrite to the supercache file if it actually exists
if (-f $document_root$supercache_file) {
rewrite ^(.*)$ $supercache_file break;
}

# all other requests go to Wordpress
if (!-e $request_filename) {
rewrite . /index.php last;
}

Save and quit - CTRL-X and Enter.

WordPress Permalinks Without WP Super Cache

If you've added the file above, ignore this section.

Create a file:

sudo nano /usr/local/nginx/conf/wordpress_params.regular

And paste this within:-

# WordPress pretty URLs: (as per dominiek.com)
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php?q=$1 last;
# Enable nice permalinks for WordPress: (as per Yawn.it)
error_page  404  = //index.php?q=$uri;

Save and quit (CTRL-X, 'y' to confirm, then Enter).

Configure Nginx for WordPress Permalinks & WP Super Cache

We'll link to either of those files now, from the virtual host file we created in Part 13: Serve Multiple Sites & Blogs with Virtual Hosts . If you have more than one standalone blog, as per Part 13, you'll have a vhost file for each, and must edit each of them.

Open the vhost file for each WP blog. For instance, for my site waywiderweb, which I've been exampling in this series:-

sudo nano /usr/local/nginx/sites-available/waywiderweb.com

If you want BOTH the WP Super Cache and the friendly URLs

After the line index index.php index.html; , so before the } , paste this:-

# Wordpress WP Super Cache plugin and permalinks.
include /usr/local/nginx/conf/wordpress_params.super_cache;

If you want ONLY the friendly URLs

After the line index index.php index.html; , so before the } , paste this:-

# Wordpress permalinks.
include /usr/local/nginx/conf/wordpress_params.regular;

Restart Nginx:-

n2r

Or, if you didn't follow Part 7: Edit bashrc for User-Friendly Linux , type:-

sudo /etc/init.d/nginx restart

Done. Check your site in a web browser.

I'd like to thank Matt Stevens and Gleb Esman for the Nginx integration.

Next Up, Installing WordPress & Other Platforms with Subversion.

That's it for pretty URIs, friendly URLs, FURLs, CURLs, permalinks or whatever else they're called. And we'll enable the caching when we install the WP Super Cache plugin. Talking of which, in the next how-to guide in this series, we do just that, using super-duper Subversion, with which we'll also simplify the WordPress installation process.

.. Damn, I'm good to you ;)   Guess what ...


SETUP an Unmanaged VPS (4 Newbies) .. The V-P-S Bible

Serve multi sites & blogs on a budget .. at the fastest possible speed .. with the least downtime .. in the most secure environment .. and future-proofed for easy admin.

That's what the VPS Bible is about, stepped out in simple copy & paste guides.

From high traffic WordPress blogs to startup web hosts, here's what you need.

Set it up?   Click here for the 21 part follow-up .. V-P-S Admin

  1. * Includes video tutorial.

  2. Not linked = not published. Won't be long. Fix a feed for updates.


If you liked that ...
  • Maintain Unmanaged VPS - Part 1: Add Web Sites Nginx Cheatsheet

    Create additional sites & blogs quickly & easily. After creating the DNS entries, just add a vhost file, its symlink, restart Nginx and go play. OK. So I did this guide already, already! But as this is one [...]
  • Maintain Unmanaged VPS - Part 2: Adding Sub-Sites with Nginx

    Create sub-sites or prefixed WordPress blogs quickly & easily. Just create an A record, add a vhost file & symlink and restart Nginx. This is very similar to adding a domain, which is detailed here and [...]
  • Set Up Unmanaged VPS (4 Newbies) - Part 15: WordPress Setup & Updates from the Command Line

    This how-to guide uses Subversion to download & install standalone WordPress blogs & their plugins, quickly and easily from your Linux command line interface, with simple updates thereafter. It also [...]
  • Set Up Unmanaged VPS (4 Newbies) .. The V-P-S Bible

    Welcome to the_guv's 20 part VPS how-to bible, complete with video tutorials. If you are outgrowing your shared host, are paying big bucks for a managed VPS or want to rightsize from an old dedicated plan, this [...]
  • Set Up Unmanaged VPS (4 Newbies) - Part 8: PHP5, MySQL and Xcache (for Platforms like WordPress)

    Bolt on PHP5 for server-side web applications, Xcache to speed things up and MySQL to handle our databases. And tweak that lot for optimum performance of platforms from WordPress to Drupal. From the first seven [...]
  • Maintain Unmanaged VPS - Part 13: Restrict Access to Nginx Web Files with Auth_Basic

    Easily restrict access to hide sensitive data, admin areas & other web pages using the Nginx web server's Auth_Basic security module & the htpasswd password creation tool. What we're gonna do, e Creaţi un nou dosar: --
    sudo nano /usr/local/nginx/conf/wordpress_params.super_cache

    And in there, paste:-

    # if the requested file exists, return it immediately
    if (-f $request_filename) {
    break;
    }
    
    set $supercache_file '';
    set $supercache_uri $request_uri;
    
    if ($request_method = POST) {
    set $supercache_uri '';
    }
    
    # Using pretty permalinks, so bypass the cache for any query string
    if ($query_string) {
    set $supercache_uri '';
    }
    
    if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
    set $supercache_uri '';
    }
    
    # if we haven't bypassed the cache, specify our supercache file
    if ($supercache_uri ~ ^(.+)$) {
    set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;
    }
    
    # only rewrite to the supercache file if it actually exists
    if (-f $document_root$supercache_file) {
    rewrite ^(.*)$ $supercache_file break;
    }
    
    # all other requests go to Wordpress
    if (!-e $request_filename) {
    rewrite . /index.php last;
    }
    

    Save and quit - CTRL-X and Enter.

    WordPress Permalinks Without WP Super Cache

    If you've added the file above, ignore this section.

    Create a file:

    sudo nano /usr/local/nginx/conf/wordpress_params.regular

    And paste this within:-

    # WordPress pretty URLs: (as per dominiek.com)
    if (-f $request_filename) {
    break;
    }
    if (-d $request_filename) {
    break;
    }
    rewrite ^(.+)$ /index.php?q=$1 last;
    # Enable nice permalinks for WordPress: (as per Yawn.it)
    error_page  404  = //index.php?q=$uri;
    

    Save and quit (CTRL-X, 'y' to confirm, then Enter).

    Configure Nginx for WordPress Permalinks & WP Super Cache

    We'll link to either of those files now, from the virtual host file we created in Part 13: Serve Multiple Sites & Blogs with Virtual Hosts . If you have more than one standalone blog, as per Part 13, you'll have a vhost file for each, and must edit each of them.

    Open the vhost file for each WP blog. For instance, for my site waywiderweb, which I've been exampling in this series:-

    sudo nano /usr/local/nginx/sites-available/waywiderweb.com

    If you want BOTH the WP Super Cache and the friendly URLs

    After the line index index.php index.html; , so before the } , paste this:-

    # Wordpress WP Super Cache plugin and permalinks.
    include /usr/local/nginx/conf/wordpress_params.super_cache;
    

    If you want ONLY the friendly URLs

    After the line index index.php index.html; , so before the } , paste this:-

    # Wordpress permalinks.
    include /usr/local/nginx/conf/wordpress_params.regular;
    

    Restart Nginx:-

    n2r

    Or, if you didn't follow Part 7: Edit bashrc for User-Friendly Linux , type:-

    sudo /etc/init.d/nginx restart

    Done. Check your site in a web browser.

    I'd like to thank Matt Stevens and Gleb Esman for the Nginx integration.

    Next Up, Installing WordPress & Other Platforms with Subversion.

    That's it for pretty URIs, friendly URLs, FURLs, CURLs, permalinks or whatever else they're called. And we'll enable the caching when we install the WP Super Cache plugin. Talking of which, in the next how-to guide in this series, we do just that, using super-duper Subversion, with which we'll also simplify the WordPress installation process.

    .. Damn, I'm good to you ;)   Guess what ...


    SETUP an Unmanaged VPS (4 Newbies) .. The V-P-S Bible

    Serve multi sites & blogs on a budget .. at the fastest possible speed .. with the least downtime .. in the most secure environment .. and future-proofed for easy admin.

    That's what the VPS Bible is about, stepped out in simple copy & paste guides.

    From high traffic WordPress blogs to startup web hosts, here's what you need.

    Set it up?   Click here for the 21 part follow-up .. V-P-S Admin

    1. * Includes video tutorial.

    2. Not linked = not published. Won't be long. Fix a feed for updates.


    If you liked that ...
    ... maybe you'll like these?

.