Last active
December 20, 2015 02:19
-
-
Save kaelzhang/6055715 to your computer and use it in GitHub Desktop.
Nginx configuration for wordpress + php + php-fpm
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
upstream php-fpm { | |
server 127.0.0.1:9000; | |
} | |
server { | |
listen 80; | |
server_name <domain>; | |
root /<server-root>; | |
index index.php; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
# This is cool because no php is touched for static content. | |
# include the "?$args" part so non-default permalinks doesn't break when using query string | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ \.php$ { | |
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
include fastcgi.conf; | |
fastcgi_intercept_errors on; | |
fastcgi_pass php-fpm; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment