Last active
November 3, 2017 04:33
-
-
Save tnqsoft/32404b915260139187d52cdf1bfa291e to your computer and use it in GitHub Desktop.
Wordpress Nginx Config
This file contains 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
# sudo vi /etc/nginx/conf.d/example.conf | |
upstream php { | |
server unix:/var/run/php-fpm/php-fpm.sock; | |
server 127.0.0.1:9000; | |
} | |
server { | |
listen 80; | |
server_name example.com www.example.com; | |
# note that these lines are originally from the "location /" block | |
root /data/www/example.com; | |
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; | |
fastcgi_buffers 16 16k; | |
fastcgi_buffer_size 32k; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
error_log /var/log/nginx/example-error.log; | |
access_log /var/log/nginx/example-access.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment