mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
Copying WROLPi nginx config on first startup so Controller is accessible.
This commit is contained in:
parent
603a2c010a
commit
8fab32ef75
3 changed files with 12 additions and 0 deletions
|
|
@ -63,6 +63,8 @@ cp /opt/wrolpi/etc/raspberrypios/50x.html /var/www/50x.html
|
|||
# Copy wrolpi.conf which defines the location blocks for reverse proxy.
|
||||
[ -f /etc/nginx/conf.d/default.conf ] && rm /etc/nginx/conf.d/default.conf
|
||||
cp /opt/wrolpi/etc/raspberrypios/wrolpi.conf /etc/nginx/conf.d/wrolpi.conf
|
||||
# Remove default site (WROLPi nginx.conf doesn't use sites-enabled).
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
# WROLPi needs a few privileged commands.
|
||||
cp /opt/wrolpi/etc/raspberrypios/90-wrolpi /etc/sudoers.d/90-wrolpi
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ cp /opt/wrolpi/etc/raspberrypios/50x.html /var/www/50x.html
|
|||
# Copy wrolpi.conf which defines the location blocks for reverse proxy.
|
||||
[ -f /etc/nginx/conf.d/default.conf ] && rm /etc/nginx/conf.d/default.conf
|
||||
cp /opt/wrolpi/etc/raspberrypios/wrolpi.conf /etc/nginx/conf.d/wrolpi.conf
|
||||
# Remove default site (WROLPi nginx.conf doesn't use sites-enabled).
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
# WROLPi needs a few privileged commands.
|
||||
cp /opt/wrolpi/etc/raspberrypios/90-wrolpi /etc/sudoers.d/90-wrolpi
|
||||
|
|
|
|||
|
|
@ -6,6 +6,14 @@ set -x
|
|||
# Generate nginx certificate for HTTPS if it doesn't exist.
|
||||
/opt/wrolpi/scripts/generate_certificates.sh
|
||||
|
||||
# Ensure nginx config files are in place (safeguard in case build didn't complete this).
|
||||
if [ ! -f /etc/nginx/conf.d/wrolpi.conf ]; then
|
||||
echo "wrolpi.conf missing, copying from /opt/wrolpi..."
|
||||
cp /opt/wrolpi/etc/raspberrypios/wrolpi.conf /etc/nginx/conf.d/wrolpi.conf
|
||||
fi
|
||||
# Remove default site if it exists (WROLPi nginx.conf doesn't use sites-enabled).
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
# Enable and start nginx now that certificates exist.
|
||||
systemctl enable nginx
|
||||
systemctl start nginx || echo "Warning: nginx failed to start"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue