Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gubatron/fc6f967d7689931c81e9e9691b714f29 to your computer and use it in GitHub Desktop.
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
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