From 80d234b3c7ee19e303492d97eafffaaff82947cb Mon Sep 17 00:00:00 2001 From: lars-hagen Date: Wed, 25 Dec 2019 23:38:13 +0100 Subject: [PATCH] fixed addDomain.sh, auto correct folder permissions, included localhost --- .env | 2 +- bin/container/addDomainCtl.sh | 14 ++++++++++---- bin/container/addDomainCtl.sh.bak | 5 +++++ conf/httpd_config.conf | 17 ++--------------- conf/httpd_config.conf.bak | 13 ++++++++----- conf/httpd_config.conf0 | 19 ++++++++++++++----- config/litespeed/1.6.4.lh/Dockerfile | 2 +- config/litespeed/1.6.4.lh/entrypoint.sh | 19 ++++++++++++------- sites/localhost/html/.gitignore | 2 ++ sites/localhost/logs/.gitignore | 2 ++ 10 files changed, 57 insertions(+), 38 deletions(-) create mode 100755 bin/container/addDomainCtl.sh.bak create mode 100755 sites/localhost/html/.gitignore create mode 100755 sites/localhost/logs/.gitignore diff --git a/.env b/.env index 6a4167a..ded170d 100644 --- a/.env +++ b/.env @@ -8,7 +8,7 @@ MYSQL_USER=wordpress MYSQL_PASSWORD=password #wordpress -DOMAIN=127.0.0.1 +DOMAIN=localhost ADMIN_USERNAME=admin ADMIN_PASSWORD=password ADMIN_EMAIL=test@test.com diff --git a/bin/container/addDomainCtl.sh b/bin/container/addDomainCtl.sh index 3bd1f73..5fbac4a 100755 --- a/bin/container/addDomainCtl.sh +++ b/bin/container/addDomainCtl.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash -perl -0777 -p -i.bak -e "s/(vhTemplate centralConfigLog \{[^}]+)\}*(^$)/\1 - member $1 { - vhDomain $1 - }/gmi" httpd_config.conf + +perl -0777 -p -i -e 's/(vhTemplate centralConfigLog \{[^}]+)\}*(^.*listeners.*$)/\1$2 + member '$1' { + vhDomain '$1' + }/gmi' httpd_config.conf + +#perl -0777 -p -i.bak -e "s/(vhTemplate centralConfigLog \{[^}]+)\}*(^$)/\1 +# member $1 { +# vhDomain $1 +# }/gmi" httpd_config.conf diff --git a/bin/container/addDomainCtl.sh.bak b/bin/container/addDomainCtl.sh.bak new file mode 100755 index 0000000..3bd1f73 --- /dev/null +++ b/bin/container/addDomainCtl.sh.bak @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +perl -0777 -p -i.bak -e "s/(vhTemplate centralConfigLog \{[^}]+)\}*(^$)/\1 + member $1 { + vhDomain $1 + }/gmi" httpd_config.conf diff --git a/conf/httpd_config.conf b/conf/httpd_config.conf index 840716c..224d0a2 100644 --- a/conf/httpd_config.conf +++ b/conf/httpd_config.conf @@ -228,21 +228,8 @@ listener HTTP { vhTemplate centralConfigLog { templateFile conf/templates/ccl.conf listeners Default, HTTP - - member example6.com { - vhDomain example6.com - } - - member example5.com { - vhDomain example5.com - } - - member example2.com { - vhDomain example2.com - } - - member example3.com { - vhDomain example3.com + member localhost { + vhDomain localhost } } diff --git a/conf/httpd_config.conf.bak b/conf/httpd_config.conf.bak index f856ac2..949488c 100644 --- a/conf/httpd_config.conf.bak +++ b/conf/httpd_config.conf.bak @@ -228,15 +228,18 @@ listener HTTP { vhTemplate centralConfigLog { templateFile conf/templates/ccl.conf listeners Default, HTTP + note test test + + member example2.com { + vhDomain example2.com + } member example6.com { vhDomain example6.com } - member example5.com { - vhDomain example5.com - } - member example2.com { - vhDomain example2.com + + member localhost { + vhDomain localhost } } diff --git a/conf/httpd_config.conf0 b/conf/httpd_config.conf0 index f856ac2..5ed6fb6 100644 --- a/conf/httpd_config.conf0 +++ b/conf/httpd_config.conf0 @@ -228,16 +228,25 @@ listener HTTP { vhTemplate centralConfigLog { templateFile conf/templates/ccl.conf listeners Default, HTTP - - member example6.com { - vhDomain example6.com + member example4.com { + vhDomain example4.com } - member example5.com { - vhDomain example5.com + member example3.com { + vhDomain example3.com } + note test test + member example2.com { vhDomain example2.com } + + member example6.com { + vhDomain example6.com + } + + member localhost { + vhDomain localhost + } } vhTemplate EasyRailsWithSuEXEC { diff --git a/config/litespeed/1.6.4.lh/Dockerfile b/config/litespeed/1.6.4.lh/Dockerfile index 946d5e8..11424f0 100644 --- a/config/litespeed/1.6.4.lh/Dockerfile +++ b/config/litespeed/1.6.4.lh/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get install mysql-client lsphp73 lsphp73-mysql lsphp73-opcache lsphp73-c EXPOSE 7080 RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \ - chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp && \ + chmod +x wp-cli.phar && mv wp-cli.phar /usr/bin/wp && \ ln -s /usr/local/lsws/lsphp73/bin/php7.3 /usr/bin/php diff --git a/config/litespeed/1.6.4.lh/entrypoint.sh b/config/litespeed/1.6.4.lh/entrypoint.sh index 93f87cf..ff43ba9 100644 --- a/config/litespeed/1.6.4.lh/entrypoint.sh +++ b/config/litespeed/1.6.4.lh/entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash +chown 999:999 /usr/local/lsws/conf -R cd /var/www/vhosts/localhost/html if [ ! -f "./wp-config.php" ]; then # su -s /bin/bash www-data -c @@ -36,15 +37,19 @@ if [ ! -f "./wp-config.php" ]; then --allow-root wp plugin install litespeed-cache \ --activate \ - --allow-root + --allow-root + first_www_uid=$(stat -c "%u" /var/www/vhosts/localhost) + first_www_gid=$(stat -c "%g" /var/www/vhosts/localhost) + chown $first_www_uid:$first_www_gid /var/www/vhosts/localhost -R + fi -#www_uid=$(stat -c "%u" /var/www/vhosts/localhost) -#if [ ${www_uid} -eq 0 ]; then -# #echo "./sites/localhost is owned by root, auto changing ownership of ./sites/localhost to uid 1000" -# chown 1000 /var/www/vhosts/localhost -R -#fi +www_uid=$(stat -c "%u" /var/www/vhosts/localhost) +if [ ${www_uid} -eq 0 ]; then + #echo "./sites/localhost is owned by root, auto changing ownership of ./sites/localhost to uid 1000" + chown 1000:1000 /var/www/vhosts/localhost -R +fi echo "WordPress installation finished." -exec "$@" \ No newline at end of file +exec "$@" diff --git a/sites/localhost/html/.gitignore b/sites/localhost/html/.gitignore new file mode 100755 index 0000000..d6b7ef3 --- /dev/null +++ b/sites/localhost/html/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/sites/localhost/logs/.gitignore b/sites/localhost/logs/.gitignore new file mode 100755 index 0000000..d6b7ef3 --- /dev/null +++ b/sites/localhost/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore