-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
I was able to get nginx up and running with a mix of reading https://picocms.org/in-depth/nginx/ and the helpful discussions at picocms/Pico#343 and picocms/Pico#350.
So yeah, it sort of worked. There was a weird problem, though. I opened my browser to /vendor/ to make sure the 404 worked, and it downloaded a plain-text version of index.php to my hard drive.
I was confuse. 😂
But, I managed to fix it! After some struggle, here's my new config. Would it be ok if I submit a PR to get this onto the "How to Configure Nginx for Pico" page?
Here's the fixed nginx config:
...
# 404 on the theme's README, CHANGELOG, etc.
location ~ ^/themes(/?$|/[^/]+(/?$|/[^/]+/?$)) {
error_page 404 /index.php;
return 404;
}
# 404 on PicoCMS README, CHANGELOG, and other forbiddens
location ~ ^/((CHANGELOG.md|CONTRIBUTING.md|LICENSE|README.md|plugins|config|content|vendor|composer\.(json|lock|phar))(/|$)|(.+/)?\.(?!well-known(/|$))) {
error_page 404 /index.php;
return 404;
}
# Rewrite all other requests to go to the front controller
location / {
error_page 404 /index.php;
try_files $uri $uri/ /index.php$uri =404;
}
# Front controller
location ~ ^/index\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
try_files $fastcgi_script_name =404;
fastcgi_param HTTP_PROXY "";
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
...Reactions are currently unavailable