-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NGINX Support #11
Comments
Very Interesting Feature / upgrade. |
EDIT: ...on second thoughts, it might not be working so well after all - the blog posts aren't displaying properly and there's a few login errors, but it does display and might help people to get started. Thanks to Cory for this SO link which helped me get it working: Config file (note that I'm completely terrible at this, so the file might be a bombsite; tips for improvement appreciated).
|
@trentyarwood You have way too much code in your snippet. You should only focus on the essentials, and let others build on top of it, with, for example, SSL support. @claviska Is this the only code that needs to be translated to nginx syntax?
|
Yep, Postleaf uses Slim so everything that doesn't exist needs to be routed through |
I have it working with the following config and php5-fpm. Won't work with hhvm though :-( updated: previous config wouldn't work with the installer
|
I lie. It almost works. When you click on a post it goes to Postleaf's 404. Which seems to suggest it's a Postleaf issue rather than nginx.
So judging by the access log, nginx has correctly redirected to index.php and Postleaf is returning the 404. |
That path is routed through Slim, so it's more likely that this is an Nginx config issue than a Postleaf issue. I'll work on Nginx support soon. Still open to sample configs if someone has a working one. |
Ok, it just works now. Wonder if it's some sort of weird date/time thing... After installing I changed the timezone to Australia. |
I'm not an Nginx guru, so correct me if I'm wrong, but due to the way the config seems to work, I don't think this is something we'll be able to do through the installer. It's going to require some preconfig. We may just need to document a general config and have the user update it manually before installing. The good news is you only have to configure a couple things:
The bad news is we can't reliably detect the server software that's running, so this will have to be an option in the installer. 🤔 |
You are correct, NGINX configuration files are stored separately, way out of web apps reach. |
I setup nginx and a server {
listen *:6500;
server_name postleaf.dev;
access_log /path/to/postleaf.dev.access.log;
error_log /path/to/postleaf.dev.error.log;
location / {
root /path/to/postleaf/app;
try_files $uri $uri/ /index.php?$args;
index index.php;
}
location ~ /(backups) {
deny all;
return 404;
}
location ~ \.php$ {
root /path/to/postleaf/app;
try_files $uri $uri/ /index.php?$args;
index index.html index.htm index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_intercept_errors on;
include fastcgi_params;
}
}
|
If someone could also help out with a Caddy rewrite code would be awesome. I tried to see if I could figure it out myself but unfortunately wasn't able to. Reference: https://caddyserver.com/docs/rewrite |
Looks like we have a good sample config. Closing since there's nothing we can preconfigure with the installer. Tutorial here: https://www.postleaf.org/running-postleaf-on-nginx Thanks @calmdev! |
This is already a common request, so let's work on getting Nginx supported officially through the installer.
The text was updated successfully, but these errors were encountered: