Centos wordpress php-fpm + nginx + apc

If you tired of having same old apache, and want something more fast and reliable, you can install nginx + php-fpm.

Firstly you need to install new repo, to have ability to add those packages. And php-fpm works out of the box (without need to patch PHP) with version PHP 5.3. Official repository does not have this version yet.

When you have more virtual hosts than one, and you want to have more convenient way to manage them, well to turn them on and off if being more precisely.
You can create two config directories. One directory “sites-available” to gave all nginx virtual host configs, and “sites-enabled”, which will be included in main nginx config file, and all symbolic links would be kept inside this direcotory pointing to real config files.

so,

then edit /etc/nginx/nginx.conf file:

after “include /etc/nginx/conf.d/*.conf”
insert line “include /etc/nginx/sites-enabled/*.conf”

and save it.

loginroot.com nginx vhost example (basic configuration just to make it work):

php-fpm default configuration should be alringht.
Well you may want to change to lines where are user and group, from apache to nginx.

also you may want to make nginx the owner of that directory.

make symbolic link to make vhost working.

Start both services, and you’re set :)

2 comments
    • all config files I keep in sites-available, but nginx takes from sites-enabled directory.
      Sites that I want to be enabled and working, I just create symlink to file existing in sites-available directory.
      So if site is enabled – “vim /etc/nginx/sites-enabled/loginroot.com” should work, because it is symlink to “/etc/nginx/sites-available/loginroot.com”.
      Anyway You would edit the same file.

Leave a Reply