Answer the question
In order to leave comments, you need to log in
Wordpress + nginx + php5-fpm setup?
There is a site on wordpress, attendance ~ 2000 per day, online 100-300 people.
All this is located on a VPS hosting with 4 CPUs and 1 Gb RAM on a bunch of pu vesta + nginx + apache + apc + mysql. Pages for unregistered users are cached and loaded in a fraction of a second, but for registered users, the mysql database often falls off. The server load at the same time ranges from 7 to 15.
I decided to transfer all this to nginx + php-fpm + apc + percona (mysql). The database does not fall off now, but another problem has arisen - it now takes 5-10 seconds to load the page, despite the fact that it is served from the cache. At the same time, the loading of the server itself does not rise above 3.5.
Tell me what can be configured to speed up page loading?
mysql config:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8
[mysqld]
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /var/run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
skip-name-resolve
sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
sysdate-is-now = 1
innodb = FORCE
innodb-strict-mode = 1
# DATA STORAGE #
datadir = /var/lib/mysql/
# BINARY LOGGING #
log-bin = /var/lib/mysql/mysql-bin
expire-logs-days = 14
sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 0
query-cache-size = 0
max-connections = 500
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 2048
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 0
innodb-log-file-size = 64M
innodb-flush-log-at-trx-commit = 0
innodb-file-per-table = 1
innodb-buffer-pool-size = 592M
# LOGGING #
log-error = off
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = off
user www-data;
worker_processes 4;
timer_resolution 100ms;
worker_rlimit_nofile 8192;
pid /var/run/nginx.pid;
events {
worker_connections 768;
use epoll;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 8m;
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log off;
gzip on;
gzip_disable "msie6";
gzip_static on;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_http_version 1.1;
gzip_proxied any;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
gzip_buffers 16 8k;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Answer the question
In order to leave comments, you need to log in
First of all, you need to optimize WP itself and not change server configs. You have to look at why the queries are so heavy, how much data is pulled, sometimes garbage is pulled from the database like design, templates or paths to css styles, and when everything is exhausted then ... not then you don’t need to edit the server, you need to change WP. On my exact same server, a site with 30,000 people a day was spinning and it was fine.
I faced the same problem - I decided to install a caching script that gives statics to everyone except the admin.
Here are two scripts - I use the second one.
centavrus-opti.ru/skript-keshirovaniya-dlya-wordpr...
isif-life.ru/blogovedenie/maxcache-snigenie-nagruz... (the main page of the script is temporarily unavailable, but you can read about the script on the Internet, and yes it paid)
The problem with comments is solved by transferring comments to discus or hypercomments.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question