Last active
September 25, 2015 03:28
-
-
Save fabiomontefuscolo/57aa3b8d2f79a74d279d to your computer and use it in GitHub Desktop.
Simple nginx conf to Wordpress
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 example.com; | |
root /srv/www/wordpress-ms; | |
gzip on; | |
gzip_disable "msie6"; | |
gzip_min_length 1100; | |
gzip_buffers 16 8k; | |
gzip_types | |
text/plain | |
text/css | |
text/js | |
text/javascript | |
application/javascript | |
application/x-javascript | |
application/json; | |
index index.php; | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 24h; | |
log_not_found off; | |
} | |
location ~ ^/[_0-9a-zA-Z-]+/files/(.*)$ { | |
try_files /wp-includes/ms-files.php?file=$2 =404; | |
access_log off; log_not_found off; expires max; | |
} | |
location ^~ /blogs.dir { | |
internal; | |
alias /srv/www/wordpress-ms/wp-content/blogs.dir ; | |
access_log off; log_not_found off; | |
expires max; | |
} | |
location ^~ /wp-content/uploads { | |
alias /srv/www/wordpress-ms/wp-content/uploads; | |
access_log off; log_not_found off; | |
expires max; | |
} | |
if (!-e $request_filename) { | |
rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last; | |
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
include fastcgi_params; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_pass php; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment