WordPress/nginx

From MattWiki
< WordPress(Redirected from Nginx/wordpress)
Jump to: navigation, search

This page will explain how I configured nginx for my WordPress sites.

My configuration prior to migrating to nginx was built on two servers as following:

Before After

Installing needed components

yum -y install nginx php-fpm

php-fpm

We will be using socket to connect to php-fpm, so you will need to change the default configuration to create a socket opposed to TCP.

vim /etc/php-fpm.d/www.conf

Around line 12, change listen from 127.0.0.1:9000 to /var/run/php-fpm.socket so it looks like:

listen = /var/run/php-fpm.socket

Then around line 39, change the user and group to nginx

user = nginx
group = nginx

Then start it:

chkconfig php-fpm on
service php-fpm start