Customizing nginx error page to help user start wrolpi services.

This commit is contained in:
Roland 2022-01-15 19:34:12 -07:00
parent 97bae3e7b2
commit 9194e47e76
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
3 changed files with 29 additions and 2 deletions

16
50x.html Normal file
View file

@ -0,0 +1,16 @@
<html>
<body>
<h1>Error!</h1>
<p>nginx could not find WROLPi! Are your services running?</p>
<p><b>sudo systemctl status wrolpi-app</b></p>
<p><b>sudo systemctl status wrolpi-api</b></p>
<p>If either of those services are not running, start it:</p>
<p><b>sudo systemctl start wrolpi-app</b></p>
<p><b>sudo systemctl start wrolpi-api</b></p>
</body>
</html>

View file

@ -89,8 +89,12 @@ sudo -u postgres psql -c '\l' | grep wrolpi || (
# Install the WROLPi nginx config over the default nginx config.
cp /opt/wrolpi/nginx.conf /etc/nginx/nginx.conf
cp /opt/wrolpi/50x.html /var/www/50x.html
/usr/sbin/nginx -s reload
# Create the media directory. This should be mounted by the maintainer.
[ -d /media/wrolpi ] || mkdir /media/wrolpi
# Create the WROLPi user
grep wrolpi /etc/passwd || useradd -d /opt/wrolpi wrolpi -s "$(command -v bash)"
chown -R wrolpi:wrolpi /opt/wrolpi
@ -121,6 +125,8 @@ echo "
WROLPi has successfully been installed!
Mount your external hard drive to /media/wrolpi if you have one.
Start the WROLPi services using:
# sudo systemctl start wrolpi.target

View file

@ -12,9 +12,14 @@ http {
charset utf-8;
include mime.types;
error_page 502 /error/50x.html;
error_page 503 /error/50x.html;
error_page 504 /error/50x.html;
server {
location /favicon.ico {
alias /opt/wrolpi/icon.ico;
location ^~ /error/ {
internal;
alias /var/www/;
}
location /apple-touch-icon.png {