Virtual Host And Certbot in Raspbian 10: Difference between revisions
Jump to navigation
Jump to search
Line 111: | Line 111: | ||
a='.well-known/acme-challenge';\ | a='.well-known/acme-challenge';\ | ||
for s in $p;do w="$s.chorke.com/html";\ | for s in $p;do w="$s.chorke.com/html";\ | ||
mkdir -p "$w/ | mkdir -p "$w/$a";\ | ||
done | done | ||
</source> | </source> |
Revision as of 03:25, 16 November 2019
All Sites# chorke.{org,com}
mkdir -p /etc/chorke/httpd/conf.sites.all.d
cd /etc/chorke/httpd/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/httpd/conf.sites.all.d
cd /etc/shahed/httpd/conf.sites.all.d
nano 00-dev.shahed.biz.conf
nano 00-dev.shahed.biz-le-ssl.conf
|
Enabled Sites# chorke.{org,com}
mkdir -p /etc/chorke/httpd/conf.sites.enable.d
cd /etc/chorke/httpd/conf.sites.enable.d
ln -s ../conf.sites.all.d/00-dev.chorke.org.conf 00-dev.chorke.org.conf
ln -s ../conf.sites.all.d/00-dev.chorke.org-le-ssl.conf 00-dev.chorke.org-le-ssl.conf
ln -s ../conf.sites.all.d/01-api.chorke.org.conf 01-api.chorke.org.conf
ln -s ../conf.sites.all.d/01-api.chorke.org-le-ssl.conf 01-api.chorke.org-le-ssl.conf
ln -s ../conf.sites.all.d/01-ihe.chorke.org.conf 01-ihe.chorke.org.conf
ln -s ../conf.sites.all.d/01-ihe.chorke.org-le-ssl.conf 01-ihe.chorke.org-le-ssl.conf
ln -s ../conf.sites.all.d/02-dev.chorke.com.conf 02-dev.chorke.com.conf
ln -s ../conf.sites.all.d/02-dev.chorke.com-le-ssl.conf 02-dev.chorke.com-le-ssl.conf
# shahed.{biz}
mkdir -p /etc/shahed/httpd/conf.sites.enable.d
cd /etc/shahed/httpd/conf.sites.enable.d
ln -s ../conf.sites.all.d/00-dev.shahed.biz.conf 00-dev.shahed.biz.conf
ln -s ../conf.sites.all.d/00-dev.shahed.biz-le-ssl.conf 00-dev.shahed.biz-le-ssl.conf
|
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
|