Created
March 15, 2019 15:23
-
-
Save elijahsgh/5c93bcbcfecb270465b5b265d68faa59 to your computer and use it in GitHub Desktop.
nginx unitd with wordpress for 1.8.0+
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
{ | |
"listeners": { | |
"*:8080": { | |
"pass": "routes/wordpress" | |
} | |
}, | |
"routes": { | |
"wordpress": [ | |
{ | |
"match": { | |
"uri": "/wp-admin/*" | |
}, | |
"action": { | |
"pass": "applications/indexphp" | |
} | |
}, | |
{ | |
"match": { | |
"uri": "*.php" | |
}, | |
"action": { | |
"pass": "applications/indexphp" | |
} | |
}, | |
{ | |
"action": { | |
"pass": "applications/scriptphp" | |
} | |
} | |
] | |
}, | |
"applications": { | |
"scriptphp": { | |
"type": "php", | |
"root": "/var/www/wordpress", | |
"script": "index.php", | |
"user": "www-data", | |
"group": "www-data", | |
"processes": 1 | |
}, | |
"indexphp": { | |
"type": "php", | |
"root": "/var/www/wordpress", | |
"index": "index.php", | |
"user": "www-data", | |
"group": "www-data", | |
"processes": 1 | |
} | |
} | |
} |
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
upstream wordpress { | |
server 127.0.0.1:8080; | |
} | |
server { | |
listen 80 default_server; | |
server_name _; | |
root /var/www/wordpress; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
expires max; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
try_files $uri @wordpress; | |
} | |
location ~ \.php$ { | |
proxy_pass http://wordpress; | |
proxy_set_header Host $host; | |
} | |
location @wordpress { | |
proxy_pass http://wordpress; | |
proxy_set_header Host $host; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico|webm|webp)$ { | |
try_files $uri =404; | |
expires max; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment