diff --git a/README.md b/README.md index de9845f..9b74fc9 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ Wordpress: - [apt-get install wordpress](https://thecustomizewindows.com/2014/04/apt-get-install-wordpress-and-cloud-installation-of-wordpress-on-ubuntu/) - [Installing Wordpress on Debian 11](https://blog.crowncloud.net/post/installing-wordpress-on-debian-11/) +Lighttpd: +- [Install Lighttpd with PHP and MariaDB](https://www.howtoforge.com/how-to-install-lighttpd-with-php-and-mariadb-on-debian-10/) ``` curl -sLo preseed.cfg https://www.debian.org/releases/stable/example-preseed.txt diff --git a/bonus.sh b/bonus.sh index 85f87ca..a5e2118 100755 --- a/bonus.sh +++ b/bonus.sh @@ -6,7 +6,7 @@ # By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2021/11/07 14:23:18 by gbaconni #+# #+# # -# Updated: 2021/11/08 22:16:10 by gbaconni ### lausanne.ch # +# Updated: 2021/11/09 06:51:27 by gbaconni ### lausanne.ch # # # # **************************************************************************** # @@ -22,15 +22,11 @@ ft_mariadb () return 0 } -ft_apache () +ft_ssl () { - if ! dpkg --get-selections | grep -qP '^apache2\t+install' + if ! dpkg --get-selections | grep -qP '^ssl-cert\t+install' then - apt-get install -qq -y ssl-cert apache2 - a2enmod alias headers ssl - a2ensite default-ssl - sed -i 's/80/4243/g; s/443/4244/g;' /etc/apache2/ports.conf /etc/apache2/sites-available/{000-default,default-ssl}.conf - sed -i 's|/var/www/html|/usr/share/wordpress|g' /etc/apache2/sites-available/{000-default,default-ssl}.conf + apt-get install -qq -y ssl-cert sed -i 's/@HostName@/localhost/' /usr/share/ssl-cert/ssleay.cnf make-ssl-cert generate-default-snakeoil --force-overwrite #openssl req -x509 \ @@ -39,6 +35,33 @@ ft_apache () # -newkey rsa:2048 -nodes -sha256 \ # -subj '/CN=localhost' -extensions EXT -config <( \ # printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") + fi + return 0 +} + +ft_lighttpd () +{ + ft_ssl + if ! dpkg --get-selections | grep -qP '^lighttpd\t+install' + then + apt-get install -qq -y lighttpd + #sed -i 's/80/4243/g; s/443/4244/g;' /etc/apache2/ports.conf /etc/apache2/sites-available/{000-default,default-ssl}.conf + #sed -i 's|/var/www/html|/usr/share/wordpress|g' /etc/apache2/sites-available/{000-default,default-ssl}.conf + systemctl reload lighttpd + fi + return 0 +} + +ft_apache_alternative () +{ + ft_ssl + if ! dpkg --get-selections | grep -qP '^apache2\t+install' + then + apt-get install -qq -y apache2 + a2enmod alias headers ssl + a2ensite default-ssl + sed -i 's/80/4243/g; s/443/4244/g;' /etc/apache2/ports.conf /etc/apache2/sites-available/{000-default,default-ssl}.conf + sed -i 's|/var/www/html|/usr/share/wordpress|g' /etc/apache2/sites-available/{000-default,default-ssl}.conf systemctl reload apache2 fi return 0 @@ -46,9 +69,11 @@ ft_apache () ft_php () { - if ! dpkg --get-selections | grep -qP '^libapache2-mod-php\t+install' + if ! dpkg --get-selections | grep -qP '^php\t+install' then - apt-get install -qq -y libapache2-mod-php php-mysql + apt-get install -qq -y php php-cgi php-fpm php-mysql + #sed -i -r 's/^(cgi.fix_pathinfo[^=]*)=.*/\1=1/' /etc/php/7.3/fpm/php.ini + #sed -i -r 's|^(listen[^=]*)=.*|\1 = /var/run/lighttpd/php.socket|' /etc/php/7.3/fpm/pool.d/www.conf fi return 0 } @@ -111,7 +136,7 @@ ft_install () { password=${1-Born2beWild} ft_mariadb ${password} - ft_apache + ft_lighttpd ft_php ft_wordpress ${password} ft_ufw