Remove custom ports for Wordpress

This commit is contained in:
gbaconni
2021-11-09 12:27:49 +01:00
parent 4f8950e4d9
commit 525b128082
3 changed files with 16 additions and 20 deletions

View File

@@ -6,7 +6,7 @@
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/11/07 14:23:18 by gbaconni #+# #+# #
# Updated: 2021/11/09 10:58:53 by gbaconni ### ########.fr #
# Updated: 2021/11/09 12:23:30 by gbaconni ### ########.fr #
# #
# **************************************************************************** #
@@ -45,10 +45,6 @@ ft_lighttpd ()
if ! dpkg --get-selections | grep -qP '^lighttpd\t+install'
then
apt-get install -qq -y lighttpd
sed -i -r 's/80/4243/g' /etc/lighttpd/lighttpd.conf
grep -q 'url.redirect' /etc/lighttpd/lighttpd.conf \
|| echo -e '\n$HTTP["scheme"] == "http" {\n\t$HTTP["host"] =~ "([^:]*)(:[0-9]+|)$" {\n\t\turl.redirect = (".*" => "https://%1:4244${url.path}${qsa}")\n\t}\n\turl.redirect-code = 302\n}\n' >> /etc/lighttpd/lighttpd.conf
sed -i -r 's/443/4244/g' /etc/lighttpd/conf-available/10-ssl.conf
sed -i -r 's|"bin-path"([^=]*=>).*|"host"\1 "127.0.0.1",|g' /etc/lighttpd/conf-available/15-fastcgi-php.conf
sed -i -r 's|"socket"([^=]*=>).*|"port"\1 "9000",|g' /etc/lighttpd/conf-available/15-fastcgi-php.conf
sed -i -r 's|^(server.document-root[^=]*=).*|\1 "/usr/share/wordpress"|g' /etc/lighttpd/lighttpd.conf
@@ -101,18 +97,18 @@ ft_wordpress ()
ft_ufw ()
{
if test -f /etc/rc.local.orig && ! grep -q 'port 4243' /etc/rc.local
if test -f /etc/rc.local.orig && ! grep -q 'port 443' /etc/rc.local
then
sed -i -r 's|(/usr/sbin/ufw allow proto tcp from any to any port)(.+)|\1\2\n\1 4243\n\1 4244|' /etc/rc.local
sed -i -r 's|(/usr/sbin/ufw allow proto tcp from any to any port)(.+)|\1\2\n\1 443\n\1 80|' /etc/rc.local
return 0
fi
if ! ufw status | grep -q '^4243/tcp'
if ! ufw status | grep -q '^443/tcp'
then
ufw allow proto tcp from any to any port 4243
ufw allow proto tcp from any to any port 443
fi
if ! ufw status | grep -q '^4244/tcp'
if ! ufw status | grep -q '^80/tcp'
then
ufw allow proto tcp from any to any port 4244
ufw allow proto tcp from any to any port 80
fi
return 0
}