Add test environment to apache

master
rohhie 2023-05-09 08:11:54 +09:00
parent 1a05030c20
commit 21ae741d11
4 changed files with 26 additions and 2 deletions

View File

@ -90,7 +90,8 @@ fi
secho 3 "=== サイト設定" secho 3 "=== サイト設定"
sudo a2dissite 000-default sudo a2dissite 000-default
sudo cp apache/*.conf /etc/apache2/sites-available/ sudo cp apache/*.conf /etc/apache2/sites-available/
sudo a2ensite example.net gitea kopano sudo a2ensite example.net gitea kopano test
[ ! -d /var/www/test ] && sudo mkdir /var/www/test && sudo chown $(whoami):$(whoami) /var/www/test
secho 3 "=== モジュールの有効化" secho 3 "=== モジュールの有効化"
sudo a2enmod ssl rewrite proxy_http headers sudo a2enmod ssl rewrite proxy_http headers

View File

@ -9,7 +9,7 @@ if [ -z $IPADDRESS ];then
IPADDRESS="127.0.0.1" IPADDRESS="127.0.0.1"
fi fi
DOMMEMBER="example\.net git\.example\.net mail\.example\.net smtp\.example\.net" DOMMEMBER="example\.net git\.example\.net mail\.example\.net smtp\.example\.net test\.example\.net"
if [ $(grep -c "$DOMMEMBER" /etc/hosts) -eq 0 ]; then if [ $(grep -c "$DOMMEMBER" /etc/hosts) -eq 0 ]; then
sudo sed -i "\$a $IPADDRESS\t$DOMMEMBER" /etc/hosts sudo sed -i "\$a $IPADDRESS\t$DOMMEMBER" /etc/hosts
else else

View File

@ -38,6 +38,7 @@ sudo rm /etc/apache2/sites-available/example.net.conf
sudo rm /etc/apache2/sites-available/gitea.conf sudo rm /etc/apache2/sites-available/gitea.conf
sudo rm /etc/apache2/sites-available/kopano.conf sudo rm /etc/apache2/sites-available/kopano.conf
sudo rm /etc/apache2/conf-available/fqdn.conf sudo rm /etc/apache2/conf-available/fqdn.conf
sudo rmdir /var/www/test
sudo apt -y purge apache2 sudo apt -y purge apache2
sudo apt -y autoremove sudo apt -y autoremove

22
apache/test.conf Normal file
View File

@ -0,0 +1,22 @@
<VirtualHost *:80>
ServerName test.example.net
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{SERVER_NAME} =test.example.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerName test.example.net
ServerAdmin webmaster@example.net
DocumentRoot /var/www/test
ErrorLog ${APACHE_LOG_DIR}/test-error.log
CustomLog ${APACHE_LOG_DIR}/test-access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/private/wildcard.example.net.crt
SSLCertificateKeyFile /etc/ssl/private/wildcard.example.net.key
</VirtualHost>