【Urgent】Please let me know the setting of Nginx of Plesk, using FastCGI Cashe to make WordPress faster.
The current settings in /etc/nginx/nginx.conf are as follows.
[root@0120-246-070 ~]# vi /etc/nginx/nginx.conf
[root@0120-246-070 ~]# nginx -t
nginx: [emerg] "fastcgi_cache" zone "wp_cache" is unknown in /etc/nginx/nginx.conf:72
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@0120-246-070 ~]# vi /etc/nginx/nginx.conf
[root@0120-246-070 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] mkdir() "/var/nginx/fastcgi-cache" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@0120-246-070 ~]# cd /var/nginx
-bash: cd: /var/nginx: No such file or directory
[root@0120-246-070 ~]# cd /var
[root@0120-246-070 var]# ls
cache drweb lib log nis preserve run www
cvs empty local mail opt proftpd.delay spool yp
db games lock named parallels qmail tmp
[root@0120-246-070 var]# cd ./run
[root@0120-246-070 run]# ls
atd.pid imapd.pid nginx-cache setrans
auditd.pid imapd-ssl.pid nginx.pid snmpd.pid
authdaemon.courier-imap kav ntpd.pid spamassassin
console lshttpd.pid php-fpm spamd.pid
ConsoleKit mailman plesk-php56-fpm.pid sshd.pid
courier-authdaemon.pid messagebus.pid plesk-php71-fpm.pid sw-collectd.pid
couriersslcache mod_fcgid plymouth sw-cp-server.pid
crond.pid monit.state pop3d.pid sw-engine.pid
cron.reboot mysqld pop3d-ssl.pid sw-engine.sock
dbus named portreserve syslogd.pid
fail2ban named.pid proftpd utmp
faillock netreport saslauthd winbindd
httpd net-snmp sepermit xinetd.pid
[root@0120-246-070 run]# vi /etc/nginx/nginx.conf
[root@0120-246-070 run]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@0120-246-070 run]# service nginx restart
Starting nginx: [ OK ]
[root@0120-246-070 run]# top
top - 20:50:17 up 1 day, 37 min, 1 user, load average: 2.78, 2.83, 3.06
Tasks: 137 total, 6 running, 131 sleeping, 0 stopped, 0 zombie
Cpu(s): 79.2%us, 18.0%sy, 0.0%ni, 0.8%id, 1.0%wa, 0.0%hi, 1.0%si, 0.0%st
Mem: 1478508k total, 1402072k used, 76436k free, 70540k buffers
Swap: 1048572k total, 212304k used, 836268k free, 928132k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6068 mysql 20 0 1144m 36m 5072 S 37.1 2.6 728:34.04 mysqld
24144 erodouji 20 0 498m 40m 24m R 35.7 2.8 5:04.15 php-fpm
24159 erodouji 20 0 497m 39m 24m R 31.8 2.7 2:41.25 php-fpm
24185 erodouji 20 0 497m 39m 24m R 31.1 2.7 1:08.20 php-fpm
24157 erodouji 20 0 498m 40m 24m R 30.4 2.8 2:09.24 php-fpm
24158 erodouji 20 0 498m 40m 24m R 28.5 2.8 3:03.02 php-fpm
24054 nginx 20 0 53160 6972 1952 S 2.0 0.5 0:46.17 nginx
323 root 20 0 0 0 0 S 0.3 0.0 0:16.13 kjournald
11404 root 30 10 236m 3592 2092 S 0.3 0.2 0:11.19 spamd
24057 root 20 0 15020 1340 1008 R 0.3 0.1 0:07.85 top
24201 root 20 0 350m 36m 20m S 0.3 2.6 0:00.21 sw-engine
1 root 20 0 19360 1080 888 S 0.0 0.1 0:00.99 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.07 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.65 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 stopper/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.15 watchdog/0
[root@0120-246-070 run]# cd /etc/nginx/
[root@0120-246-070 nginx]# vi nginx.conf
#user nginx;
worker_processes 1;
worker_rlimit_nofile 16384;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 365;
#tcp_nodelay on;
gzip on;
gzip_min_length 0;
gzip_buffers 4 8k;
gzip_types text/plain text/xml application/x-javascript text/css;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
##
# Fastcgi_cache Settings
##
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:4m inactive=7d max_size=50m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
server_tokens off;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
The current settings in /etc/nginx/nginx.conf are as follows.
[root@0120-246-070 ~]# vi /etc/nginx/nginx.conf
[root@0120-246-070 ~]# nginx -t
nginx: [emerg] "fastcgi_cache" zone "wp_cache" is unknown in /etc/nginx/nginx.conf:72
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@0120-246-070 ~]# vi /etc/nginx/nginx.conf
[root@0120-246-070 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] mkdir() "/var/nginx/fastcgi-cache" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@0120-246-070 ~]# cd /var/nginx
-bash: cd: /var/nginx: No such file or directory
[root@0120-246-070 ~]# cd /var
[root@0120-246-070 var]# ls
cache drweb lib log nis preserve run www
cvs empty local mail opt proftpd.delay spool yp
db games lock named parallels qmail tmp
[root@0120-246-070 var]# cd ./run
[root@0120-246-070 run]# ls
atd.pid imapd.pid nginx-cache setrans
auditd.pid imapd-ssl.pid nginx.pid snmpd.pid
authdaemon.courier-imap kav ntpd.pid spamassassin
console lshttpd.pid php-fpm spamd.pid
ConsoleKit mailman plesk-php56-fpm.pid sshd.pid
courier-authdaemon.pid messagebus.pid plesk-php71-fpm.pid sw-collectd.pid
couriersslcache mod_fcgid plymouth sw-cp-server.pid
crond.pid monit.state pop3d.pid sw-engine.pid
cron.reboot mysqld pop3d-ssl.pid sw-engine.sock
dbus named portreserve syslogd.pid
fail2ban named.pid proftpd utmp
faillock netreport saslauthd winbindd
httpd net-snmp sepermit xinetd.pid
[root@0120-246-070 run]# vi /etc/nginx/nginx.conf
[root@0120-246-070 run]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@0120-246-070 run]# service nginx restart
Starting nginx: [ OK ]
[root@0120-246-070 run]# top
top - 20:50:17 up 1 day, 37 min, 1 user, load average: 2.78, 2.83, 3.06
Tasks: 137 total, 6 running, 131 sleeping, 0 stopped, 0 zombie
Cpu(s): 79.2%us, 18.0%sy, 0.0%ni, 0.8%id, 1.0%wa, 0.0%hi, 1.0%si, 0.0%st
Mem: 1478508k total, 1402072k used, 76436k free, 70540k buffers
Swap: 1048572k total, 212304k used, 836268k free, 928132k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6068 mysql 20 0 1144m 36m 5072 S 37.1 2.6 728:34.04 mysqld
24144 erodouji 20 0 498m 40m 24m R 35.7 2.8 5:04.15 php-fpm
24159 erodouji 20 0 497m 39m 24m R 31.8 2.7 2:41.25 php-fpm
24185 erodouji 20 0 497m 39m 24m R 31.1 2.7 1:08.20 php-fpm
24157 erodouji 20 0 498m 40m 24m R 30.4 2.8 2:09.24 php-fpm
24158 erodouji 20 0 498m 40m 24m R 28.5 2.8 3:03.02 php-fpm
24054 nginx 20 0 53160 6972 1952 S 2.0 0.5 0:46.17 nginx
323 root 20 0 0 0 0 S 0.3 0.0 0:16.13 kjournald
11404 root 30 10 236m 3592 2092 S 0.3 0.2 0:11.19 spamd
24057 root 20 0 15020 1340 1008 R 0.3 0.1 0:07.85 top
24201 root 20 0 350m 36m 20m S 0.3 2.6 0:00.21 sw-engine
1 root 20 0 19360 1080 888 S 0.0 0.1 0:00.99 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.07 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.65 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 stopper/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.15 watchdog/0
[root@0120-246-070 run]# cd /etc/nginx/
[root@0120-246-070 nginx]# vi nginx.conf
#user nginx;
worker_processes 1;
worker_rlimit_nofile 16384;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
include /etc/nginx/modules.conf.d/*.conf;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 365;
#tcp_nodelay on;
gzip on;
gzip_min_length 0;
gzip_buffers 4 8k;
gzip_types text/plain text/xml application/x-javascript text/css;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
##
# Fastcgi_cache Settings
##
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:4m inactive=7d max_size=50m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
server_tokens off;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;