mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
replace lighttd with nginx
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -7,15 +7,14 @@ ENV USER=pi USER_ID=1000 USER_GID=1000 TZ=Europe/London PORT=20211
|
||||
# Todo, do we still need all these packages? I can already see sudo which isn't needed
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python3 iproute2 nmap python3-pip zip -y \
|
||||
&& apt-get install --no-install-recommends ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo nginx-light php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python3 iproute2 nmap python3-pip zip -y \
|
||||
&& pip3 install requests \
|
||||
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
|
||||
&& apt-get clean autoclean \
|
||||
&& apt-get autoremove \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /var/www/html \
|
||||
&& ln -s /home/pi/pialert/front /var/www/html \
|
||||
&& lighttpd-enable-mod fastcgi-php
|
||||
&& ln -s /home/pi/pialert/front /var/www/html
|
||||
|
||||
|
||||
# now creating user
|
||||
@@ -31,13 +30,12 @@ COPY . /home/pi/pialert
|
||||
|
||||
# Pi.Alert
|
||||
RUN python /home/pi/pialert/back/pialert.py update_vendors \
|
||||
&& sed -ie 's/= 80/= '${PORT}'/g' /etc/lighttpd/lighttpd.conf \
|
||||
&& rm /etc/nginx/sites-available/default \
|
||||
&& ln -s /home/pi/pialert/install/default /etc/nginx/sites-available/default \
|
||||
&& sed -ie 's/listen 80/listen '${PORT}'/g' /etc/nginx/sites-available/default \
|
||||
&& (crontab -l 2>/dev/null; cat /home/pi/pialert/install/pialert.cron) | crontab -
|
||||
|
||||
# it's easy for permissions set in Git to be overridden, so doing it manually
|
||||
RUN chmod -R a+rxw /home/pi/pialert/
|
||||
|
||||
# keep backward-compatibility with old links using <url>/pialert as a base (remove in 2023)
|
||||
RUN ln -s /home/pi/pialert/front /var/www/html/pialert
|
||||
|
||||
CMD ["/home/pi/pialert/dockerfiles/start.sh"]
|
||||
@@ -7,9 +7,11 @@ if [ -n "${TZ}" ]; then
|
||||
sed -ie "s|Europe/Berlin|${TZ}|g" /home/pi/pialert/config/pialert.conf
|
||||
crontab < /home/pi/pialert/install/pialert.cron
|
||||
fi
|
||||
|
||||
if [ -n "${PORT}" ]; then
|
||||
sed -ie 's/= 20211/= '${PORT}'/g' /etc/lighttpd/lighttpd.conf
|
||||
sed -ie 's/listen 20211/listen '${PORT}'/g' /etc/nginx/sites-available/default
|
||||
fi
|
||||
|
||||
/etc/init.d/lighttpd start
|
||||
/etc/init.d/php7.4-fpm start
|
||||
/etc/init.d/nginx start
|
||||
cron -f
|
||||
|
||||
12
install/default
Normal file
12
install/default
Normal file
@@ -0,0 +1,12 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
root /var/www/html;
|
||||
index index.php;
|
||||
|
||||
location ~* \.php$ {
|
||||
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user