Top Nav

Archive | Nginx

CentOS / Nginx / PHP-FPM / WordPress

Some quick notes on building a CentOS server with Nginx, PHP-FPM and WordPress.

First here’s great tutorial that covers the different Fedura / CentOS / RedHat versions:

http://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/

To support WordPress I added the following line  into /etc/nginx/sites-enabled/acme.com.conf:

 

0

ServerAlias On Nginx

On Apache web servers, each virtual host has a “ServerName” directive and zero or more “ServerAlias” directives. When converting to Nginx there is only one directive – “server_name” which takes the place of both of the Apache directives. The “server_name” directive takes a set of space delimited arguments listing domains that should match the virtual host. So for example if you have this Apache config:

Then for Nginx use:

This is a simple example for full details see this page in the Nginx documentation:

http://nginx.org/en/docs/http/server_names.html

2

Canonical Rewrite Rule For Nginx

Need to redirect from acme.com to www.acme.com with nginx? No problem … just add a virtual host declaration for the non-www that redirects like this:

or if you want to add to an existing vhost:

3