Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Node.js/PHP NGINX Config for Headless WordPress
server {
server_name climb.localhost *.climb.localhost;
root /home/curtis/Wordpress;
listen 80;
listen [::]:80;
# Catch all php files first
location ~ \.php$ {
fastcgi_keep_conn on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
# Catch remaining WordPress-specific routing/static files
location ~ (/wp-(.*)|robots\.txt$|sitemap_index\.xml$) {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
# Everything else - proxy to NodeJS
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment