# Preparing for Large-scale Wordpress MU Usage

**URL:** <https://www.ruby-forum.com/t/preparing-for-large-scale-wordpress-mu-usage/219996>\
**Category:** NGINX\
**Created:** [May 24, 2012, 11:17am UTC](https://www.ruby-forum.com/t/preparing-for-large-scale-wordpress-mu-usage/219996 "2012-05-24T11:17:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 24, 2012, 11:17am UTC](https://www.ruby-forum.com/t/preparing-for-large-scale-wordpress-mu-usage/219996/1 "2012-05-24T11:17:15Z")

</div>

I’m preparing to deploy a new Nginx server hosting Wordpress MU to our  
school. Each wordpress site will serve as a student ePortfolio. I’m  
concerned about when all 500 students hit the site and start editing at  
the same time. The particulars of my setup are below. What can I  
expect/do to prepare for the mass hit of users on my site?

I am running Wordpress Quick Cache, & apc (for php caching).

The Server:

OS: Ubuntu Linux 12.04 LTS  
Web server: Nginx (naturally)  
PHP: php5-fpm  
RAM 16 GB  
CPUs: 2 CPUs with 4 cores each (total of 8 cores).

My nginx.conf file:

* * *

user www-data;  
worker\_processes 8;  
pid /var/run/nginx.pid;

events {  
worker\_connections 2048;  
# multi\_accept on;  
}

http {  
sendfile on;  
tcp\_nopush on;  
tcp\_nodelay on;  
server\_tokens off;  
include mime.types;  
default\_type application/octet-stream;  
index index.php index.htm index.html redirect.php;

```
    client_max_body_size 512M;

#Gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 64 32k;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_types text/plain text/css application/json

```

application/x-javascript text/xml  
application/xml application/xml+rss  
text/javascript;

```
#FastCGI
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 32 64k;
fastcgi_buffer_size 256k;
fastcgi_read_timeout 500;
fastcgi_index index.php;

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*; #Our individual site vhost

```

server files will live here  
}

* * *

My site file:

* * *

server {  
listen 80;

```
server_name students.scisdragons.net;
root /var/www/students.scisdragons.net;
access_log /var/log/nginx/students.scisdragons.net.access.log;
error_log /var/log/nginx/students.scisdragons.net.error.log;

    include global/wordpress-ms-subdir.conf;

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires 1y;
    log_not_found off;
    }

```

}

* * *

And my Wordpress Config file

* * *

location / {  
try\_files $uri $uri/ /index.php?$args;  
}

location /phpmyadmin {  
root /usr/share/;  
index index.php index.html index.htm;  
location ~ ^/phpmyadmin/(.+.php)$ {  
# Zero-day exploit defense.  
#

> **[nginx 0day exploit for nginx + fastcgi PHP](https://forum.nginx.org/read.php?2,88845,page=3)**
>
> This is currently doing the rounds, so I thought it pertinent to post it here too. http://www.webhostingtalk.com/showthread.php?p=6807475#post6807475 I don't know what nginx should do to fix this, but there are two workarounds given. If you allow...

# Won’t work properly (404 error) if the file is  
not stored on this server, which is entirely possible with  
php-fpm/php-fcgi.  
# Comment the ‘try\_files’ line out if you set up  
php-fpm/php-fcgi on another machine. And then cross your fingers that  
you won’t get hacked.  
try\_files $uri =404;

```
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    include fastcgi_params;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;  
# fastcgi\_intercept\_errors on;  
fastcgi\_pass 127.0.0.1:9000;  
}  
location ~\*  
^/phpmyadmin/(.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {  
root /usr/share/;  
}  
}  
location /phpMyAdmin {  
rewrite ^/\* /phpmyadmin last;  
}

# Add trailing slash to \*/wp-admin requests.

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

# Directives to send expires headers and turn off 404 error logging.

location ~\* .(js|css|png|jpg|jpeg|gif|ico|mov|mp4|avi|doc|docx|pdf)$ {  
expires 48h;  
log\_not\_found off;  
}

# Pass uploaded files to wp-includes/ms-files.php.

rewrite /files/$ /index.php last;

# For multisite: Use a caching plugin/script that creates symlinks to

the correct subdirectory structure to get some performance gains.  
set $cachetest  
“$document\_root/wp-content/cache/ms-filemap/${host}${uri}”;  
if ($uri ~ /$) {  
set $cachetest “”;  
}  
if (-f $cachetest) {  
# Rewrites the URI and stops rewrite processing so it doesn’t  
start over and attempt to pass it to the next rule.  
rewrite ^ /wp-content/cache/ms-filemap/${host}${uri} break;  
}

if ($uri !~ wp-content/plugins) {  
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;  
}

# Uncomment one of the lines below for the appropriate caching plugin

(if used).

# include global/wordpress-ms-subdir-wp-super-cache.conf;

# include global/wordpress-ms-subdir-w3-total-cache.conf;

# Rewrite multisite ‘…/wp-._’ and '…/_.php’.

if (!-e $request\_filename) {  
rewrite ^/[\_0-9a-zA-Z-]+(/wp-._) $1 last;  
rewrite ^/[\_0-9a-zA-Z-]+(/._.php)$ $1 last;  
}

# Pass all .php files onto a php-fpm/php-fcgi server.

location ~ .php$ {  
# Zero-day exploit defense.  
# [nginx 0day exploit for nginx + fastcgi PHP](http://forum.nginx.org/read.php?2,88845,page=3)  
# Won’t work properly (404 error) if the file is not stored on  
this server, which is entirely possible with php-fpm/php-fcgi.  
# Comment the ‘try\_files’ line out if you set up  
php-fpm/php-fcgi on another machine. And then cross your fingers that  
you won’t get hacked.  
try\_files $uri =404;

```
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;

# fastcgi\_intercept\_errors on;

```
    fastcgi_pass 127.0.0.1:9000;

```

}

* * *

Posted at Nginx Forum:

> **[Preparing for Large-scale Wordpress MU Usage](https://forum.nginx.org/read.php?2,226786,226786#msg-226786)**
>
> I'm preparing to deploy a new Nginx server hosting Wordpress MU to our school. Each wordpress site will serve as a student ePortfolio. I'm concerned about when all 500 students hit the site and start editing at the same time. The particulars of my...

---

<div class="post-metadata">

**Author:** ![CheezItMan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@CheezItMan](https://www.ruby-forum.com/u/CheezItMan)\
**Post date:** [May 24, 2012, 11:14pm UTC](https://www.ruby-forum.com/t/preparing-for-large-scale-wordpress-mu-usage/219996/2 "2012-05-24T23:14:56Z")

</div>

Hi “CheezItMan”,

500 users are not much, except you’re running everything from a tiny  
ARM-powered machine. Come to think of it, even that will suffice. 😉

Make sure to install a static-site generator for Wordpress, “WP Super  
Cache Plus” for example (perhaps your “ms-file” cache already does  
that; didn’t look into it). Then it will be Nginx serving static files  
most of the time. Gzip\_static module for Nginx helps, too, provided  
your caching-plugin generates \*.gz files along with the uncompressed  
ones.

A mediocre MySQL installation can bear some thousands inserts per  
second. So you will most probably run out of available PHP workers.  
Configure a reasonable high number of “spare server” in PHP FPM and  
observe the load and memory usage, tune, observe and so forth.

–  
Mark

2012/5/24 CheezItMan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![CheezItMan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@CheezItMan](https://www.ruby-forum.com/u/CheezItMan)\
**Post date:** [May 25, 2012, 2:14am UTC](https://www.ruby-forum.com/t/preparing-for-large-scale-wordpress-mu-usage/219996/3 "2012-05-25T02:14:44Z")

</div>

Thanks for the reply. I’m running Quick cache, but [bliz.io](http://bliz.io) still  
reports failed connections at 250 and 500 users. I’ll try supercache,  
it previously didn’t really help multisite (except the root of the  
multisite).

The new version of Supercache does seem to work better. However running  
[blitz.io](http://blitz.io) with 1000 people connecting I still get 100 or so timeouts and  
a few errors. Granted it’s 100 or so timeouts out of several thousand  
but still…

## W-Mark K. Wrote:

> cache already does  
> that; didn’t look into it). Then it will be Nginx  
> serving static files  
> most of the time. Gzip\_static module for Nginx  
> helps, too, provided  
> your caching-plugin generates \*.gz files along  
> with the uncompressed  
> ones.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,226786,226815#msg-226815](http://forum.nginx.org/read.php?2,226786,226815#msg-226815)

---

<div class="post-metadata">

**Author:** ![CheezItMan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@CheezItMan](https://www.ruby-forum.com/u/CheezItMan)\
**Post date:** [May 25, 2012, 4:19am UTC](https://www.ruby-forum.com/t/preparing-for-large-scale-wordpress-mu-usage/219996/4 "2012-05-25T04:19:41Z")

</div>

Also visitors really isn’t the problem, its EDITORS. 500 users posting  
content simultaneously will be the problem.

Posted at Nginx Forum:

> **[Re: Preparing for Large-scale Wordpress MU Usage](https://forum.nginx.org/read.php?2,226786,226816#msg-226816)**
>
> I'm preparing to deploy a new Nginx server hosting Wordpress MU to our school. Each wordpress site will serve as a student ePortfolio. I'm concerned about when all 500 students hit the site and start editing at the same time. The particulars of my...
