From 8f0497844b2fc9e3364ad7193ec61a48ccc301a1 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 19 Mar 2020 13:25:29 +0000 Subject: [PATCH] update enable mod_rewrite on container --- dev/config/000-default.conf | 11 +++++++++++ dev/container-create.sh | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 dev/config/000-default.conf diff --git a/dev/config/000-default.conf b/dev/config/000-default.conf new file mode 100644 index 0000000..3ccf48c --- /dev/null +++ b/dev/config/000-default.conf @@ -0,0 +1,11 @@ + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html/wordpress + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + diff --git a/dev/container-create.sh b/dev/container-create.sh index 8fc6795..5274ceb 100755 --- a/dev/container-create.sh +++ b/dev/container-create.sh @@ -5,6 +5,7 @@ set -e _host="$_local_hostname.$_local_domain" _user_root='root' _ssh_cmd_root="ssh $_user_root@$_host" +_scp_to="$_user_root@$_host" _ssh_cmd_www="sshpass -p$_passwd_www ssh $_user_www@$_host" _ssh_cmd_www_cd="$_ssh_cmd_www cd /var/www/html/wordpress &&" @@ -15,7 +16,8 @@ printf "\nInstalling requirements ..." $_ssh_cmd_root 'apt-get update && apt-get -y upgrade && apt-get -y install apache2 mariadb-server php php-common libapache2-mod-php python-mysqldb php-gd php-ssh2 php-mysql php-dom php-simplexml php-xml php-xmlreader php-curl php-ftp php-iconv php-imagick php-mbstring php-posix php-sockets php-tokenizer php-zip' printf "\nConfiguring Apache ..." -$_ssh_cmd_root 'sed -i '\''s+DocumentRoot /var/www/html$+DocumentRoot /var/www/html/wordpress+'\'' /etc/apache2/sites-enabled/000-default.conf && systemctl restart apache2' +scp ./dev/config/000-default.conf "$_scp_to":/etc/apache2/sites-enabled/000-default.conf +$_ssh_cmd_root 'a2enmod rewrite; systemctl restart apache2' printf "\nSetting %s permissions ..." "$_user_www" $_ssh_cmd_root "echo \"$_user_www:$_passwd_www\" | chpasswd"