Substitute
- domain_name1.com: Your domain name
- extra_domain_name.com: Extra domains if your also using extra domain mapping in wordpress
- file_root: Path to your wordpress install
Files
/etc/nginx/sites-available/domain_name1.com
# WordPress Multi Site Domain
server {
listen 80 ;
server_name .domain_name1.com .extra_domain_name.com;
root /file_root/wordpress;
index index.php index.html index.htm;
# Rewrite for multi site files
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
# Rewrite for wordpress
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~ .php$ {
fastcgi_pass unix:/tmp/php-fastcgi.socket; # or port like 127.0.0.1:9000
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Finish
sudo ln -s /etc/nginx/sites-available/domain_name.com /etc/nginx/sites-enabled/domain_name.com
sudo service nginx restart
This entry was posted in Server, Uncategorized. Bookmark the
permalink. Both comments and trackbacks are currently closed.
4 Comments
Hey, that definately saved my day! Thx!
Thanks mate! Kind words always appreciated.
Hi,
Thanks for this. Will it work with sub-domains and directories in a WordPress network?
Thanks,
Joe
Hi Joe, I don’t know what changes would be required for a sub-directory setup. I’ve only every employed the sub-domain setup. I know the instructions are a bit terse and probably designed for people who already have nginx / php experience but if you have any trouble setting up a sub-domain install feel free to post more questions.