From 0bfc4aaa51a40c9f74a39e779b9aa144011a0d09 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 8 Sep 2021 16:15:07 +0000 Subject: [PATCH] fixed docker build files for ubuntu --- codepot/docker/apache2-fg.sh | 14 +++++++------- codepot/docker/build-rocky8.sh | 4 +++- codepot/docker/build-ubnt2004.sh | 7 +++++++ codepot/docker/httpd-fg.sh | 8 ++++---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/codepot/docker/apache2-fg.sh b/codepot/docker/apache2-fg.sh index 19a03c7d..c1367d8d 100755 --- a/codepot/docker/apache2-fg.sh +++ b/codepot/docker/apache2-fg.sh @@ -139,7 +139,7 @@ EOF ## change the port number as specified on the command line echo "Configuring to listen on the port[$SERVICE_PORT] hide-index-page[$HIDE_INDEX_PAGE] https-redirected[$HTTPS_REDIRECTED]" -sed -r -i "s|^Listen[[:space:]]+.*|Listen ${SERVICE_PORT}|g" "${HTTPD_CONFIG_FILE}" +sed -r -i "s|^Listen[[:space:]]+.*|Listen ${SERVICE_PORT}|g" "/etc/apache2/ports.conf" if [[ "${HTTPS_REDIRECTED}" =~ [Yy][Ee][Ss] ]] then @@ -155,20 +155,20 @@ fi if [[ "${HIDE_INDEX_PAGE}" =~ [Yy][Ee][Ss] ]] then sed -r -i 's|^index_page[[:space:]]*=.*$|index_page=""|g' "${CODEPOT_CONFIG_FILE}" - cat < /var/www/html/.htaccess -RewriteEngine On + + echo 'RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^(.*)$ index.php/$1 [L] -EOF - sed -r -i '//,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$| AllowOverride All|g' "${HTTPD_CONFIG_FILE}" +RewriteRule ^(.*)$ index.php/$1 [L]' > /var/www/html/.htaccess + + sed -r -i '//,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$|\tAllowOverride All|g' "${HTTPD_CONFIG_FILE}" else sed -r -i 's|^index_page[[:space:]]*=.*$|index_page="index.php"|g' "${CODEPOT_CONFIG_FILE}" rm -rf /var/www/html/.htaccess - sed -r -i '//,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$| AllowOverride None|g' "${HTTPD_CONFIG_FILE}" + sed -r -i '//,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$|\tAllowOverride None|g' "${HTTPD_CONFIG_FILE}" fi #httpd server in the foreground diff --git a/codepot/docker/build-rocky8.sh b/codepot/docker/build-rocky8.sh index c8feef4e..17be400d 100755 --- a/codepot/docker/build-rocky8.sh +++ b/codepot/docker/build-rocky8.sh @@ -1,6 +1,8 @@ - cd /tmp +## delete all files under /var/www/html +rm -rf /var/www/html/* + tar -zxvf codepot-0.4.0.tar.gz && mv -f codepot-0.4.0 codepot && \ touch -r * */* */*/* */*/*/* */*/*/*/* && \ cd codepot && \ diff --git a/codepot/docker/build-ubnt2004.sh b/codepot/docker/build-ubnt2004.sh index 62a01d6b..cbad8eb8 100755 --- a/codepot/docker/build-ubnt2004.sh +++ b/codepot/docker/build-ubnt2004.sh @@ -1,5 +1,11 @@ cd /tmp +## delete all files under /var/www/html +rm -rf /var/www/html/* + +a2enmod rewrite +a2enmod headers + tar -zxvf codepot-0.4.0.tar.gz && mv -f codepot-0.4.0 codepot && \ cd codepot && \ ./configure \ @@ -24,6 +30,7 @@ sed -ri -e 's|Digest::SHA1|Digest::SHA|g' /etc/codepot/perl/Codepot/AccessHandle cp -pf /etc/codepot/codepot.httpd /etc/apache2/conf-enabled/codepot.conf && \ echo "PerlSwitches -Mlib=/etc/codepot/perl" >> /etc/apache2/conf-enabled/perl.conf + apt remove --purge -y --allow-remove-essential php-dev libsvn-dev make libfdisk1 && \ apt autoremove --purge -y && rm -rf /var/lib/apt/lists/* diff --git a/codepot/docker/httpd-fg.sh b/codepot/docker/httpd-fg.sh index 8815a65c..e4db4bd7 100755 --- a/codepot/docker/httpd-fg.sh +++ b/codepot/docker/httpd-fg.sh @@ -151,13 +151,13 @@ fi if [[ "${HIDE_INDEX_PAGE}" =~ [Yy][Ee][Ss] ]] then sed -r -i 's|^index_page[[:space:]]*=.*$|index_page=""|g' "${CODEPOT_CONFIG_FILE}" - cat < /var/www/html/.htaccess -RewriteEngine On + + echo 'RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^(.*)$ index.php/$1 [L] -EOF +RewriteRule ^(.*)$ index.php/$1 [L]' > /var/www/html/.htaccess + sed -r -i '//,/<\/Directory>/s|^[[:space:]]*AllowOverride[[:space:]]+.*$| AllowOverride All|g' "${HTTPD_CONFIG_FILE}" else