WordPress specific Nginx configurations, tweaks, compatibility routines, etc.
Tested with Nginx version 1.4.x in
- Debian 6.x & Debian 7.x
- Ubuntu 12.04.x
For Fedora, Redhat, CentOS and Amazon Linux AMI or similar distributions, please look at the CentOS branch.
Please backup your old configuration files...
TIMESTAMP=$(date +%F_%H-%M-%S)
mkdir $HOME/nginx-backup-$TIMESTAMP
cp -a /etc/nginx/* $HOME/nginx-backup-$TIMESTAMP
As sudo or root, please use the following guidelines...
git clone git://github.com/pothi/WordPress-Nginx.git $HOME/git/wp-nginx
cd $HOME/git/wp-nginx
git checkout centos
cp -a $HOME/git/wp-nginx/* /etc/nginx/
rm /etc/nginx/sites-enabled/domainname.conf
# Other steps that depends on your particular requirement:
# YOUR_DOMAIN_NAME=tinywp.com
# mv /etc/nginx/sites-available/domainname.conf /etc/nginx/sites-available/$YOUR_DOMAIN_NAME.conf
# cd /etc/nginx/sites-enabled/
# ln -s ../sites-available/$YOUR_DOMAIN_NAME.conf
# sed -i --follow-symlinks 's/domainname.com/'$YOUR_DOMAIN_NAME'/g' /etc/nginx/sites-enabled/$YOUR_DOMAIN_NAME.conf
# nginx -t && service nginx restart
CentOS has a different file naming convention, yet simple directory structure, when compared to Debian derivatives. Let me describe them and I'd let you decide upon how you'd want to structure your files and name those files.
- The configuration for default sites are named as
default.conf
andssl.conf
in/etc/nginx/conf.d/
. - There is no
sites-available
orsites-enabled
folder. - The file
/etc/nginx/fastcgi_params
in Debian is named as/etc/nginx/fastcgi.conf
in CentOS.
- Please submit issues or bugs via Github
- Patches, improvements, and suggestions are welcomed.
- Please use contact form at https://www.tinywp.in/contact/ , if you'd like to contact Pothi Kalimuthu for other reasons.
- I'm available for hire to setup, tweak or troubleshoot your server to provide the fastest WordPress hosting.
- Thanks for having a look here. Have a good time!