I have a Kirby website running on a DigitalOcean server running Ubuntu 16.04 and Nginx. I based my Nginx configuration on this one: https://gist.github.com/bastianallgeier/c2e1f1e519f5f2943ec4.
It all worked fine until I tried to install ssl via Let’s Encrypt to run the page on https following this guide: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
When i point the browser to the page, the html gets loaded but it can’t find any resources because kirby print url:s without the domain in it. The css link looks like this for example:
<link rel="stylesheet" href="https:///assets/css/main.min.css">
What to do?
That shouldn’t be happening. Does it still work via HTTP (given that you don’t redirect to HTTPS for now) or is that broken now as well?
What you could try however is to manually set the URL in the Kirby configuration:
That’s not optimal as it should work without the option, but that should at least make the site work again.
Thank you Lukas. That fixed the url’s but all pages are treated as the home page. If I go to a sub page the url is right but all the pages use the home template… Very strange.
To be honest we don’t have much experience with Nginx and test with Apache mostly. So I can’t really tell why this is happening. Maybe someone else in the community has seen something like this before. Otherwise you could switch to Apache, that should most likely work.
I guess I have to go back to simple http because the performance boost to switch from apache to Nginx is to good. To bad, the plan was to run a secure and very fast http/2 server.
Iisn’t getkirby.com running on Nginx and https @bastianallgeier? Doesn’t feel right to go back and run a insecure protocol this days…
Sounds like Kirby can’t find your templates or /site/templates folder for some reason ?
I’m serving multiple sites through a Kirby installation on Ubuntu 16.04 (super fast) over PHP7, Nginx with http/2 and letsencrypt on DigitalOcean, so it is possible
By the way, make sure to revisit the updated Nginx Config to get Kirby Routes and in particular Plugin Assets up and running on Nginx.
Good to know that it’s possible. @JimmyRittenborg do you use server blocks to host several domain on the same server (that’s what I do) or just one per server? Don’t know if that can be part off my problem.
I will have an other goo for it later…
Yes I do use a server block for each host domain on the same server (my loadbalancer).
But my entire setup is a bit custom as I have a loadbalancer (w/ a floating IP) to which I can attach multiple webservers and scale both vertical and horizontally behind.
Also the Kirby installation on my webservers is a bit custom in terms of linking up sites, and routing site resources (like /site/templates, in my setup a site’s config.php can actually specify a design to which /site/templates is routed ).
I’m also issuing the smaller, more performant and more secure ECDSA certs through letsencrypt, but this requires custom creation of CSR’s and therefore a custom handling of renewals. But although not being the easiest setup - it works really pretty well
So if I extracted my Nginx config structure for you, it wouldn’t work for you out of the box and would require changes to the SSL part of the config.
It could maybe also be the way I’ve setup my loadbalancer and how my webserver therefore just have to listen for $host which allows my setup.