script
#!/bin/bash
ssh -o StrictHostKeyChecking=no -i {{ssh_key}} -p {{port}} {{username}}@{{host}} << 'EOF'
cat > /etc/apache2/sites-enabled/everlms/{{domain}}.conf << 'EOF_REMOTE'
<VirtualHost *:80>
ServerAdmin admin@{{domain}}
ServerName {{domain}}
ServerAlias
Redirect / https://{{domain}}/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@{{domain}}
ServerName {{domain}}
ServerAlias
DocumentRoot {{docroot}}
DirectoryIndex index.php
<Directory {{docroot}}>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
AuthUserFile /etc/apache2/.htpasswd
AuthName "you must log in to see this folder"
AuthType Basic
Require valid-user
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/{{maindomain}}/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/{{maindomain}}/privkey.pem
<FilesMatch \.php$>
# From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog /var/log/apache2/everlms/{{domain}}-error.log
#CustomLog /var/log/apache2/site_access.log combined
</VirtualHost>
EOF_REMOTE
sudo service apache2 reload
EOF
ssh -o StrictHostKeyChecking=no -i {{ssh_key}} -p {{port}} {{username}}@{{host}} << 'EOF'
cat > /etc/apache2/sites-enabled/everlms/{{domain}}.conf << 'EOF_REMOTE'
<VirtualHost *:80>
ServerAdmin admin@{{domain}}
ServerName {{domain}}
ServerAlias
Redirect / https://{{domain}}/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@{{domain}}
ServerName {{domain}}
ServerAlias
DocumentRoot {{docroot}}
DirectoryIndex index.php
<Directory {{docroot}}>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
AuthUserFile /etc/apache2/.htpasswd
AuthName "you must log in to see this folder"
AuthType Basic
Require valid-user
</Directory>
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/{{maindomain}}/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/{{maindomain}}/privkey.pem
<FilesMatch \.php$>
# From the Apache version 2.4.10 and above, use the SetHandler to run PHP as a fastCGI process server
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog /var/log/apache2/everlms/{{domain}}-error.log
#CustomLog /var/log/apache2/site_access.log combined
</VirtualHost>
EOF_REMOTE
sudo service apache2 reload
EOF
ID
point_domain