Created
March 29, 2017 02:29
-
-
Save fengluo/fff4d0470a9ce515c8d59bbc383eb9b1 to your computer and use it in GitHub Desktop.
wordpress.conf
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
server { | |
root /wordpress_path; | |
index index.html index.htm index.php; | |
# Make site accessible from http://localhost/ | |
server_name server_names; | |
client_max_body_size 10m; | |
# enforce www (exclude certain subdomains) | |
if ($host !~* ^(www|subdomain)) | |
{ | |
rewrite ^/(.*)$ $scheme://www.$host/$1 permanent; | |
} | |
# unless the request is for a valid file, send to bootstrap | |
if (!-e $request_filename) | |
{ | |
rewrite ^(.+)$ /index.php?q=$1 last; | |
} | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
#error_page 500 502 503 504 /50x.html; | |
#location = /50x.html { | |
# root /usr/share/nginx/www; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
location ~ \.php$ { | |
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
try_files $uri =404; | |
#fastcgi_pass 127.0.0.1:9000; | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
# deny access to apache .htaccess files | |
location ~ /\.ht | |
{ | |
deny all; | |
} | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
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