Hi there. I have $5 droplet, running a Wordpress website for flash games. When the online users hit 30+ CPU usage is 98.5% almost always. I do not use any resourceful plugins, besides WP Super cache. I have followed all of the tutorials published on digital ocean how to run a Wordpress website. I ran top command to see what was the problem and here is the result: Link Maybe my nginx server block is not configured properly? Here it is:
server {
listen 80;
server_name www.gungameshub.com gungameshub.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 default_server ssl;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.php index.html index.htm;
server_name gungameshub.com www.gungamehub.com;
ssl on;
ssl_certificate www.gungameshub.com.chained.crt;
ssl_certificate_key www.gungameshub.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
include /etc/nginx/block.conf;
location /xmlrpc.php {
deny all;
}
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 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null 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|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locat$
set $cache_uri 'null 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 'null cache';
}
# 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 ;
}
location /articles/ {
try_files /articles/wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /articles/index.php?$args;
}
location /m/ {
try_files /m/wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /m/index.php?$args;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 30d;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
location = /mobile/ {
return 301 /m/;
}
location = /blog {
return 301 /articles/;
}
location = /blog/ {
return 301 /articles/;
}
location = /mobile {
return 301 /m/;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
After looking at /var/log/nginx/error.log I found out, that timthumb triggered tons of php errors due to not-existence of cache folder. Fixed it, fixed the problem.
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.