Add an offline page to display when Discourse is rebuilding or starting up

Yes!
Thanks for pointing this out, I updated my post to be more clear in this aspect.

2 Likes

Would this also work with 16.04 LTS? Because I donā€™t think I need to install certbot-auto in 16.04 LTS.

The howto was created with 16.04, so my steps should match exactly :slight_smile:

I can understand thatā€¦ but in your post you said:

So I wanted to know from @codinghorror if the auto renew steps he added would work with 16.04LTS?

@fefrei Can you guide me on how to auto renew without certbot-auto?

Now I feel stupidā€¦ let me check the documentation

I use this simple shell script, run by cron:

#!/bin/bash
letsencrypt renew
/usr/sbin/service nginx reload
2 Likes

This basically means that you are renewing the certificate everyday, right?

No it doesnā€™t. Cron jobs donā€™t have to be daily - you can pick any time period that you want.

1 Like

certbot renew only processes certs it deems due for renewal. I run this script weekly, which effectively renews every two months or so.

2 Likes

you mean letsencrypt renew

1 Like

True that ā€“ the client is being renamed to certbot, so Iā€™m mixing them up all the time because the name depends on your distribution and versionā€¦

Slightly off-topic, but if you use CloudFlareā€™s DNS you will get an offline page and a cached version of your site provided by them, without even touching your Discourse setup.

2 Likes

I did followed your @fefrei instructions and everything working fine. Thanks to your well documentation :+1:. When I stop discourse Iā€™m getting my special error page. But when Iā€™m rebuilding discourse Iā€™m getting the default 404 error page!.

Is there is anything I could do yet to fix this?

Wait, you should never get a 404. Can you post a screenshot of the error message? Does the error persist after rebuilding completes?

1 Like

Iā€™ll try to capture it for you with my second rebuild. But it is regular Nginx 404 error page, nothing special.
No. After the rebuild completed everything working as expected. Iā€™m getting my Discourse site running fine.

And this is requested screenshot.

I hope you have a solution for this.

I have no idea why this is happening :frowning:

One of the first steps of rebuilding is to stop the container. Your nginx shouldnā€™t be able to distinguish rebuilding from a stopped container even if it wanted toā€¦

Maybe a close look at nginxā€™s logs could shed some light onto this?

Thank you @fefrei. Iā€™m surprised too.

Where to locate the right Nginxā€™s logs?

I think the logs on your host are most interesting ā€“ depending on your Linux distribution, they should be in /var/log/nginx/ or a similar place.

Iā€™ve updated the initial post to also recommend enabling http2 in the nginx configuration.

1 Like