Question
nginx wordpress w3cache configuration
Hi,
I have followed the below links to install LEMP stack on my droplet.
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-on-centos-7
I was able to follow the steps successfully and get my sites up and running.
I also followed a guide to set up a swap memory. Viewing my droplet graphs I can see that a lot of processing is going on. That I believe is due to multiple new WordPress sites hosted on that droplet and crawlers fetching that new data. I was not able to enable w3cache on any of those WordPress sites. It would be helpful if you can guide me to set up w3cache and reduce some load on my droplet.
Here is my current config file for one of my website. All other WordPress configs are almost similar:
server {
listen 80;
server_name example.com www.example.com;
# note that these lines are originally from the "location /" block
root /var/www/example.com/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
# 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 ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Thanks.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×