Skip to content

Instantly share code, notes, and snippets.

@danyal2050
Forked from pviojo/<domain>.conf
Created January 3, 2020 06:01
Show Gist options
  • Save danyal2050/5fa80547a6998c82cc7056e011ba8b04 to your computer and use it in GitHub Desktop.
Save danyal2050/5fa80547a6998c82cc7056e011ba8b04 to your computer and use it in GitHub Desktop.
Nginx conf. Wordpress blog in a subdirectory (/blog)
server {
listen 80;
server_name <domain>
server_name_in_redirect off;
access_log logs/<domain>.access.log;
error_log logs/<domain>.error.log;
gzip_static on;
root /www/<domain>;
index index.php;
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location /blog {
try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}
location ~ .*\.php[345]?$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment