Created
September 20, 2015 16:45
-
-
Save mpeshev/abcb11e3f0029dd9fb6c to your computer and use it in GitHub Desktop.
nginx parent WordPress config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name maindomain.com; | |
root /var/www/maindomain.com; | |
index index.php index.html index.htm; | |
location / { | |
index index.html index.php; | |
try_files $uri $uri/ /index.php?q=$uri&$args; | |
#try_files $uri $uri/ /index.php?q=$uri&$args; | |
} | |
rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 24h; | |
log_not_found off; | |
} | |
if ($uri !~ wp-content/plugins) { | |
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last; | |
} | |
if (!-e $request_filename) { | |
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last; | |
rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last; | |
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last; | |
} | |
location ~ \.php$ { | |
try_files $uri /index.php; | |
autoindex on; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
#fastcgi_pass_header Set-Cookie; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment