Virtual Host And Certbot in Raspbian 10: Difference between revisions
Jump to navigation
Jump to search
Line 72: | Line 72: | ||
/etc/apache2/sites-enabled/01-ihe.chorke.org-le-ssl.conf | /etc/apache2/sites-enabled/01-ihe.chorke.org-le-ssl.conf | ||
apache2ctl -t | |||
</source> | |||
<source lang="bash" style="border:3px dashed blue"> | |||
# chorke.com | |||
ln -s /etc/chorke/apache2/conf.sites.all.d/02-dev.chorke.com-le-ssl.conf\ | ln -s /etc/chorke/apache2/conf.sites.all.d/02-dev.chorke.com-le-ssl.conf\ | ||
/etc/apache2/sites-enabled/02-dev.chorke.com-le-ssl.conf | /etc/apache2/sites-enabled/02-dev.chorke.com-le-ssl.conf |
Revision as of 09:38, 16 November 2019
Apache2
All Sites# chorke.{org,com}
mkdir -p /etc/chorke/apache2/conf.sites.all.d
cd /etc/chorke/apache2/conf.sites.all.d
nano 00-dev.chorke.org.conf
nano 00-dev.chorke.org-le-ssl.conf
nano 01-api.chorke.org.conf
nano 01-api.chorke.org-le-ssl.conf
nano 01-ihe.chorke.org.conf
nano 01-ihe.chorke.org-le-ssl.conf
nano 02-dev.chorke.com.conf
nano 02-dev.chorke.com-le-ssl.conf
# shahed.biz
mkdir -p /etc/shahed/apache2/conf.sites.all.d
cd /etc/shahed/apache2/conf.sites.all.d
nano 03-dev.shahed.biz.conf
nano 03-dev.shahed.biz-le-ssl.conf
|
Enabled Sites# chorke.{org,com}
cd /etc/apache2/sites-enabled
ln -s /etc/chorke/apache2/conf.sites.all.d/00-dev.chorke.org.conf\
/etc/apache2/sites-enabled/00-dev.chorke.org.conf
ln -s /etc/chorke/apache2/conf.sites.all.d/01-api.chorke.org.conf\
/etc/apache2/sites-enabled/01-api.chorke.org.conf
ln -s /etc/chorke/apache2/conf.sites.all.d/01-ihe.chorke.org.conf\
/etc/apache2/sites-enabled/01-ihe.chorke.org.conf
ln -s /etc/chorke/apache2/conf.sites.all.d/02-dev.chorke.com.conf\
/etc/apache2/sites-enabled/02-dev.chorke.com.conf
apache2ctl -t
# shahed.biz
cd /etc/apache2/sites-enabled
ln -s /etc/shahed/apache2/conf.sites.all.d/03-dev.shahed.biz.conf\
/etc/apache2/sites-enabled/03-dev.shahed.biz.conf
apache2ctl -t
|
Enabled HTTPS
# chorke.org
ln -s /etc/chorke/apache2/conf.sites.all.d/00-dev.chorke.org-le-ssl.conf\
/etc/apache2/sites-enabled/00-dev.chorke.org-le-ssl.conf
ln -s /etc/chorke/apache2/conf.sites.all.d/01-api.chorke.org-le-ssl.conf\
/etc/apache2/sites-enabled/01-api.chorke.org-le-ssl.conf
ln -s /etc/chorke/apache2/conf.sites.all.d/01-ihe.chorke.org-le-ssl.conf\
/etc/apache2/sites-enabled/01-ihe.chorke.org-le-ssl.conf
apache2ctl -t
# chorke.com
ln -s /etc/chorke/apache2/conf.sites.all.d/02-dev.chorke.com-le-ssl.conf\
/etc/apache2/sites-enabled/02-dev.chorke.com-le-ssl.conf
apache2ctl -t
# shahed.biz
ln -s /etc/shahed/apache2/conf.sites.all.d/03-dev.shahed.biz-le-ssl.conf\
/etc/apache2/sites-enabled/03-dev.shahed.biz-le-ssl.conf
apache2ctl -t
Directory Tree
mkdir -p /var/chorke/www;\
cd /var/chorke/www/;p='api dev ihe';\
for s in $p;do d='html docs soft';\
for f in $d;do w="$s.chorke.org/$f";\
mkdir -p "$w";\
done;
done
|
mkdir -p /var/chorke/www;\
cd /var/chorke/www/;p='dev';\
for s in $p;do d='html docs soft';\
for f in $d;do w="$s.chorke.com/$f";\
mkdir -p "$w";\
done;
done
|
mkdir -p /var/shahed/www;\
cd /var/shahed/www/;p='dev';\
for s in $p;do d='html docs soft';\
for f in $d;do w="$s.shahed.biz/$f";\
mkdir -p "$w";\
done;
done
|
Acme Challenges
cd /var/chorke/www/;p='api dev ihe';\
a='.well-known/acme-challenge';\
for s in $p;do w="$s.chorke.org/html";\
mkdir -p "$w/$a";\
done
|
cd /var/chorke/www/;p='dev';\
a='.well-known/acme-challenge';\
for s in $p;do w="$s.chorke.com/html";\
mkdir -p "$w/$a";\
done
|
cd /var/shahed/www/;p='dev';\
a='.well-known/acme-challenge';\
for s in $p;do w="$s.shahed.biz/html";\
mkdir -p "$w/$a";\
done
|
;nano /var/chorke/www/api.chorke.org/html/.htaccess
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{SERVER_NAME} =api.chorke.org [OR]
RewriteCond %{SERVER_NAME} =www.api.chorke.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
f='html docs soft';\
for s in *.chorke.*;do for d in $f;do \
h="<html>\n<head><title>$s/$d</title></head>\n";
h="$h<body><h1>Welcome to, $s/$d</h1></body>\n</html>";
echo -e "$h" >> "$s/$d/index.html";
done;done
|
f='html docs soft';\
for s in *.shahed.biz;do for d in $f;do \
h="<html>\n<head><title>$s/$d</title></head>\n";
h="$h<body><h1>Welcome to, $s/$d</h1></body>\n</html>";
echo -e "$h" >> "$s/$d/index.html";
done;done
apt -y install apache2 mod_ssl; a2enmod ssl
cd /opt/;git clone https://github.com/certbot/certbot.git
cd /usr/local/bin/;ln -s /opt/certbot/certbot-auto certbot
ln -s /opt/certbot/letsencrypt-auto letsencrypt
letsencrypt #letsencrypt renew
certbot #certbot renew
|