Last active
November 14, 2019 17:34
-
-
Save gubatron/fc6f967d7689931c81e9e9691b714f29 to your computer and use it in GitHub Desktop.
Configuration of a wordpress site served from a URL's directory (not the root) on NGINX
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 { | |
server_name www.gubatron.com; | |
listen 80; | |
listen [::]:80; | |
root /media/ebs/data/websites/gubatron.com/; | |
index index.php index.html index.htm; | |
# wordpress lives at gubatron.com/blog/... | |
rewrite ^/blog/wp-admin/(.*) /blog/wp-admin/$1; | |
#search redirect | |
rewrite ^/blog/(.*)s=(.*)$ /blog/index.php?s=$2; | |
try_files $uri $uri/ /blog/index.php$is_args$args; | |
location ~ \.php { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; | |
include fastcgi_params; | |
} | |
location ~ \.git { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment