Virtual Host And Certbot in WSL2: Difference between revisions
Jump to navigation
Jump to search
(48 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<source lang="bash"> | <source lang="bash"> | ||
a2enmod alias;\ | |||
a2enmod include;\ | |||
a2enmod authz_host;\ | |||
a2enmod substitute;\ | |||
a2enmod negotiation | |||
a2enmod proxy;\ | a2enmod proxy;\ | ||
a2enmod proxy_http;\ | a2enmod proxy_http;\ | ||
a2enmod proxy_balancer;\ | a2enmod proxy_balancer;\ | ||
a2enmod lbmethod_byrequests | a2enmod lbmethod_byrequests | ||
service apache2 restart | service apache2 restart | ||
</source> | </source> | ||
Line 19: | Line 26: | ||
'''virtual site locations:''' | '''virtual site locations:''' | ||
mkdir -p /mnt/d/var/www/dev.chorke.com/{docs,html,logs,soft} | mkdir -p /mnt/d/var/www/dev.chorke.com/{docs,html,logs,soft} | ||
mkdir -p /mnt/d/var/www/dev.shahed.biz/{docs,html,logs,soft} | mkdir -p /mnt/d/var/www/dev.shahed.biz/{docs,html,logs,soft} | ||
mkdir -p /mnt/d/var/www/{api,dev}.chorke.org/{docs,html,logs,soft} | |||
mkdir -p /mnt/d/var/www/dev.chorke.com/html/.well-known/acme-challenge | mkdir -p /mnt/d/var/www/dev.chorke.com/html/.well-known/acme-challenge | ||
mkdir -p /mnt/d/var/www/dev.shahed.biz/html/.well-known/acme-challenge | mkdir -p /mnt/d/var/www/dev.shahed.biz/html/.well-known/acme-challenge | ||
mkdir -p /mnt/d/var/www/{api,dev}.chorke.org/html/.well-known/acme-challenge | |||
==Enable== | ==Enable== | ||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org.conf | '''cd /etc/apache2/sites-enabled/''' | ||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org.conf 00-dev.chorke.org.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org.conf 01-api.chorke.org.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org.conf | ln -s /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com.conf 02-dev.chorke.com.conf | ||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz.conf 03-dev.shahed.biz.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org-le-ssl.conf | '''cd /etc/apache2/sites-enabled/''' | ||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org-le-ssl.conf 00-dev.chorke.org-le-ssl.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org-le-ssl.conf 01-api.chorke.org-le-ssl.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org-le-ssl.conf | ln -s /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com-le-ssl.conf 02-dev.chorke.com-le-ssl.conf | ||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz-le-ssl.conf 03-dev.shahed.biz-le-ssl.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com-le-ssl.conf | |||
ln -s /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz-le-ssl.conf | |||
Virtual Host configuration skipped to avoid redundancy. Please find the config details in [[Virtual Host And Certbot in Raspbian 10]]. | ''Virtual Host configuration skipped to avoid redundancy. Please find the config details in [[Virtual Host And Certbot in Raspbian 10]]''. | ||
==Virtual Host== | ==Virtual Host== | ||
Line 62: | Line 57: | ||
ProxyPreserveHost On | ProxyPreserveHost On | ||
AllowEncodedSlashes Off | AllowEncodedSlashes Off | ||
ServerAdmin info | ServerAdmin info<at>shahed.biz | ||
DocumentRoot /mnt/d/var/www/dev.shahed.biz/html | DocumentRoot /mnt/d/var/www/dev.shahed.biz/html | ||
Line 123: | Line 118: | ||
</source> | </source> | ||
== | ==PgAdmin4== | ||
===Package=== | |||
<source lang="bash"> | |||
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add | |||
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > \ | |||
/etc/apt/sources.list.d/pgadmin4.list && apt update' | |||
sudo apt install pgadmin4-web;\ | |||
sudo /usr/pgadmin4/bin/setup-web.sh | |||
</source> | |||
===Manual=== | |||
<source lang="bash"> | |||
apt install python3 python3-pip libgmp3-dev libpq-dev libapache2-mod-wsgi-py3;\ | |||
apt install python3-venv;python3 -m venv /mnt/d/var/www/dev.shahed.biz/pgadmin4;\ | |||
source /mnt/d/var/www/dev.shahed.biz/pgadmin4/bin/activate | |||
python3 -m pip install -U pip; python3 -m pip install wheel;\ | |||
python3 -m pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v5.4/pip/pgadmin4-5.4-py3-none-any.whl | |||
mkdir /var/log/pgadmin4; mkdir -p /var/lib/pgadmin4/{sessions,storage};\ | |||
chown -R www-data:www-data /var/{lib,log}/pgadmin4 | |||
</source> | |||
<source lang="bash"> | |||
cat <<EOF >> /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/config_local.py | |||
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions' | |||
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db' | |||
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log' | |||
STORAGE_DIR = '/var/lib/pgadmin4/storage' | |||
UPGRADE_CHECK_ENABLED = False | |||
SERVER_MODE = True | |||
EOF | |||
</source> | |||
<source lang="bash"> | |||
python /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/setup.py | |||
: <<'END_COMMENT' | |||
NOTE: Configuring authentication for SERVER mode. | |||
Enter the email address and password to use for the initial pgAdmin user account: | |||
Email address: info<at>shahed.biz | |||
Password: | |||
Retype password: | |||
pgAdmin 4 - Application Initialisation | |||
====================================== | |||
END_COMMENT | |||
deactivate | |||
</source> | |||
'''Apache Config:''' | |||
<source lang="apache"> | |||
WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/mnt/d/var/www/dev.shahed.biz/pgadmin4 | |||
WSGIScriptAlias /pgadmin4 "/mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/pgAdmin4.wsgi" | |||
<Directory "/mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/"> | |||
WSGIProcessGroup pgadmin | |||
WSGIApplicationGroup %{GLOBAL} | |||
Require all granted | |||
</Directory> | |||
</source> | |||
'''Export Import:''' | |||
<source lang="bash"> | |||
source /mnt/d/var/www/dev.shahed.biz/pgadmin4/bin/activate | |||
python /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/setup.py\ | |||
--dump-servers /mnt/c/Users/shahed/Downloads/pgadmin4.json\ | |||
--user info<at>shahed.biz | |||
python /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/setup.py\ | |||
--load-servers /mnt/c/Users/shahed/Downloads/pgadmin4.json\ | |||
--user info<at>shahed.biz | |||
deactivate | |||
</source> | |||
==Alias Config== | |||
<source lang="apache" highlight="3,4,10-19,22-38"> | |||
# vim /etc/apache2/mods-enabled/alias.conf | |||
<IfModule alias_module> | |||
Alias /icons/ "/mnt/d/usr/share/apache2/icons/" | |||
<Directory "/mnt/d/usr/share/apache2/icons"> | |||
Options FollowSymlinks Indexes MultiViews | |||
AllowOverride None | |||
Require all granted | |||
</Directory> | |||
Alias /error/ "/usr/share/apache2/error/" | |||
<Directory "/usr/share/apache2/error"> | |||
AllowOverride None | |||
Options IncludesNoExec | |||
AddOutputFilter Includes html | |||
AddHandler type-map var | |||
Require all granted | |||
LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr | |||
ForceLanguagePriority Prefer Fallback | |||
</Directory> | |||
</IfModule> | |||
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var | |||
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var | |||
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var | |||
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var | |||
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var | |||
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var | |||
ErrorDocument 410 /error/HTTP_GONE.html.var | |||
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var | |||
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var | |||
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var | |||
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var | |||
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var | |||
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var | |||
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var | |||
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var | |||
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var | |||
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var | |||
</source> | |||
==Auto Index== | |||
<code>vim /etc/apache2/mods-enabled/autoindex.conf</code> | |||
<source lang="apache" highlight="8,9,18,19,21,23,27-37,41-45,49,53,55,87-120,128,134" line> | |||
<IfModule mod_autoindex.c> | |||
# Directives controlling the display of server-generated directory listings. | |||
# | |||
# IndexOptions: Controls the appearance of server-generated directory | |||
# listings. | |||
# Remove/replace the "Charset=UTF-8" if you don't use UTF-8 for your filenames. | |||
IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* Charset=UTF-8 SuppressDescription SuppressRules FoldersFirst XHTML | |||
IndexStyleSheet /icons/style.css | |||
# | |||
# AddIcon* directives tell the server which icon to show for different | |||
# files or filename extensions. These are only displayed for | |||
# FancyIndexed directories. | |||
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip x-bzip2 | |||
AddIconByType (TXT,/icons/text.gif) text/* | |||
AddIconByType (IMG,/icons/image.gif) image/* | |||
AddIconByType (SND,/icons/sound.gif) audio/* | |||
AddIconByType (VID,/icons/movie.gif) video/* | |||
AddIconByType (HTML,/icons/html.gif) text/html | |||
AddIcon /icons/binary.gif .bin .exe .so .dll | |||
AddIcon /icons/binhex.gif .hqx | |||
AddIcon /icons/tar.gif .tar | |||
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv | |||
AddIcon /icons/compressed.gif .Z .z .7z .tgz .gz .zip | |||
AddIcon /icons/a.gif .ps .ai .eps .doc .psd .docx | |||
AddIcon /icons/html.gif .html .shtml .htm .css .xml .xhtml .chm | |||
AddIcon /icons/pdf.gif .pdf | |||
AddIcon /icons/log.gif .log | |||
AddIcon /icons/c.gif .c .cpp .c++ .h | |||
AddIcon /icons/pl.gif .pl | |||
AddIcon /icons/py.gif .py .pyc | |||
AddIcon /icons/spy.gif .spy | |||
AddIcon /icons/php.gif .php | |||
AddIcon /icons/cgi.gif .cgi | |||
AddIcon /icons/f.gif .for | |||
AddIcon /icons/dvi.gif .dvi | |||
AddIcon /icons/uuencoded.gif .uu | |||
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl .cmd .bat | |||
AddIcon /icons/jar.gif .jar | |||
AddIcon /icons/pom.gif .pom | |||
AddIcon /icons/md5.gif .md5 | |||
AddIcon /icons/sha1.gif .sha1 | |||
AddIcon /icons/tex.gif .tex | |||
# It's a suffix rule, so simply matching "core" matches "score" as well ! | |||
AddIcon /icons/bomb.gif /core | |||
AddIcon (SND,/icons/sound.gif) .ogg | |||
AddIcon (VID,/icons/movie.gif) .ogm | |||
AddIcon /icons/back.gif .. | |||
AddIcon /icons/hreadme.gif readme README | |||
AddIcon /icons/folder.gif ^^DIRECTORY^^ | |||
AddIcon /icons/folder.open.gif ^^BLANKICON^^ | |||
# Default icons for OpenDocument format | |||
AddIcon /icons/odf6odt-20x22.png .odt | |||
AddIcon /icons/odf6ods-20x22.png .ods | |||
AddIcon /icons/odf6odp-20x22.png .odp | |||
AddIcon /icons/odf6odg-20x22.png .odg | |||
AddIcon /icons/odf6odc-20x22.png .odc | |||
AddIcon /icons/odf6odf-20x22.png .odf | |||
AddIcon /icons/odf6odb-20x22.png .odb | |||
AddIcon /icons/odf6odi-20x22.png .odi | |||
AddIcon /icons/odf6odm-20x22.png .odm | |||
AddIcon /icons/odf6ott-20x22.png .ott | |||
AddIcon /icons/odf6ots-20x22.png .ots | |||
AddIcon /icons/odf6otp-20x22.png .otp | |||
AddIcon /icons/odf6otg-20x22.png .otg | |||
AddIcon /icons/odf6otc-20x22.png .otc | |||
AddIcon /icons/odf6otf-20x22.png .otf | |||
AddIcon /icons/odf6oti-20x22.png .oti | |||
AddIcon /icons/odf6oth-20x22.png .oth | |||
# | |||
# DefaultIcon is which icon to show for files which do not have an icon | |||
# explicitly set. | |||
DefaultIcon /icons/unknown.gif | |||
# | |||
# AddDescription allows you to place a short description after a file in | |||
# server-generated indexes. These are only displayed for FancyIndexed | |||
# directories. | |||
# Format: AddDescription "description" filename | |||
AddDescription "Readme File" readme | |||
AddDescription "Core File" core | |||
AddDescription "GZIP compressed document" .gz | |||
AddDescription "GZIP compressed tar archive" .tgz | |||
AddDescription "Tar archive" .tar | |||
AddDescription "Zip Archive" .zip | |||
AddDescription "<a href=\"http://www.apple.com/quicktime/\" title=\"Quicktime\">QuickTime</a> Movie" .mov | |||
AddDescription "<a href=\"http://www.real.com/\" title=\"RealNetworks\">RealNetworks</a> Movie" .ra .ram | |||
AddDescription "Plain-text Document" .txt | |||
AddDescription "Web document" .HTML .xhtml | |||
AddDescription "Compile HTML" .chm .CHM | |||
AddDescription "Document" .ps .ai .eps .pdf .psd .doc .docx | |||
AddDescription "Binary File" .bin .exe .so .dll .pyc .class | |||
AddDescription "Log File" .log | |||
AddDescription "MD5 Digest" .md5 .jar.md5 .pom.md5 | |||
AddDescription "SHA1 Digest" .sha1 .jar.sha1 pom.sha1 | |||
AddDescription "Java Archive" .jar | |||
AddDescription "Maven pom" .pom | |||
AddDescription "Script" .conf .sh .shar .csh .ksh .tcl .cmd .bat | |||
AddDescription "PHP Script" .php | |||
AddDescription "Perl Script" .pl | |||
AddDescription "Pyhon Script" .py .spy | |||
AddDescription "C Script" .cpp .c++ | |||
AddDescription "3D World" .wrl .wrl.gz .vrml .vrm .iv | |||
AddDescription "Icon" .ico | |||
AddDescription "<acronym title=\"Motion Picture Experts Group Audio Layer 3\">MP3</acronym> Audio File" .mp3 | |||
AddDescription "<acronym title=\"HyperText Markup Language\">HTML</acronym> Page" .html .htm .shtml | |||
AddDescription "<acronym title=\"Portable Network Graphics\">PNG</acronym> Image" .png | |||
AddDescription "<acronym title=\"Graphics Interchange Format\">GIF</acronym> Image" .gif | |||
AddDescription "<acronym title=\"Joint Photographic Experts Group\">JPEG</acronym> Image" .jpg .jpeg | |||
AddDescription "<acronym title=\"Bitmap\">BMP</acronym> Image" .bmp | |||
AddDescription "<acronym title=\"Extensive Markup Language\">XML</acronym> File" .xml | |||
AddDescription "<acronym title=\"Common Gateway Interface\">CGI</acronym> parsed script" .cgi | |||
AddDescription "<acronym title=\"Cascading Style Sheet\">CSS</acronym> File" .css | |||
# | |||
# ReadmeName is the name of the README file the server will look for by | |||
# default, and append to directory listings. | |||
# | |||
# HeaderName is the name of a file which should be prepended to | |||
# directory indexes | |||
ReadmeName /icons/README.html | |||
HeaderName HEADER.html | |||
# | |||
# IndexIgnore is a set of filenames which directory indexing should ignore | |||
# and not include in the listing. Shell-style wildcarding is permitted. | |||
IndexIgnore .??* *~ *# RCS CVS *,v *,t HEADER.html README.html favicon.ico README cgi-bin | |||
</IfModule> | |||
</source> | |||
==Error Doc== | |||
<code>vim /usr/share/apache2/error/include/top.html</code> | |||
<source lang="html" highlight="10,11,13-18" line> | |||
<!--#if expr="-z v('CONTENT_LANGUAGE')" | |||
--><!--#set var="CONTENT_LANGUAGE" value="en" | |||
--><!--#endif | |||
--><?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml" lang="<!--#echo var="CONTENT_LANGUAGE" -->" xml:lang="<!--#echo var="CONTENT_LANGUAGE" -->"> | |||
<head> | |||
<title><!--#echo encoding="none" var="TITLE" --></title> | |||
<link rev="made" href="mailto:<!--#echo encoding="url" var="SERVER_ADMIN" -->" /> | |||
<link rel="icon" type="image/x-icon" href="/icons/favicon.ico"> | |||
<link rel="stylesheet" href="/icons/style.css" type="text/css" /> | |||
<style type="text/css"><!--/*--><![CDATA[/*><!--*/ | |||
body { | |||
margin: 20%; | |||
} | |||
/*]]>*/--> | |||
</style> | |||
</head> | |||
<body> | |||
<h1><!--#echo encoding="none" var="TITLE" --></h1> | |||
<p> | |||
</source> | |||
<code>vim /usr/share/apache2/error/include/bottom.html</code> | |||
<source lang="html" highlight="11-15" line> | |||
</p> | |||
<p> | |||
<!--#include virtual="../contact.html.var" --> | |||
</p> | |||
<h2>Error <!--#echo encoding="none" var="REDIRECT_STATUS" --></h2> | |||
<address> | |||
<a href="/"><!--#echo var="SERVER_NAME" --></a><br /> | |||
<span><!--#echo var="SERVER_SOFTWARE" --></span> | |||
</address> | |||
<div align="right"> | |||
<a href="https://chorke.org" target="_blank"> | |||
<img src="/icons/powered_by_chorke_logo.png" alt="Powered by Chorke, Inc." title="Chorke, Inc." border="0"> | |||
</a> | |||
</div> | |||
</body> | |||
</html> | |||
</source> | |||
==Knowledge== | ==Knowledge== | ||
apachectl -t | |||
apachectl -M | |||
apache2ctl -M | |||
sudo service apache2 restart | sudo service apache2 restart | ||
sudo service postgresql restart | |||
sudo service redis-server restart | sudo service redis-server restart | ||
==References== | ==References== | ||
{| | |||
| valign="top" | | |||
* [[Academia JavaEE Workspace in Raspbian]] | |||
* [[Virtual Host And Certbot in Raspbian 10]] | * [[Virtual Host And Certbot in Raspbian 10]] | ||
* [https://www.pgadmin.org/docs/pgadmin4/development/import_export_servers.html Export Import PgAdmin 4 Servers] | |||
* [[Virtual Host And Certbot in RHEL7]] | * [[Virtual Host And Certbot in RHEL7]] | ||
* [[Virtual Host And Certbot in RHEL6]] | * [[Virtual Host And Certbot in RHEL6]] | ||
* [[Docker on Windows]] | * [[Docker on Windows]] | ||
* [[IntelliJ IDEA]] | |||
* [[PostgreSQL]] | |||
* [[Kubernetes]] | * [[Kubernetes]] | ||
* [[Docker]] | * [[Docker]] | ||
| valign="top" | | |||
* [https://www.digitalocean.com/community/tutorials/how-to-install-configure-pgadmin4-server-mode Install and Configure pgAdmin 4 in Server Mode] | |||
* [[Install pgAdmin 4 in Server Mode]] | |||
|} |
Latest revision as of 18:29, 18 July 2021
a2enmod alias;\
a2enmod include;\
a2enmod authz_host;\
a2enmod substitute;\
a2enmod negotiation
a2enmod proxy;\
a2enmod proxy_http;\
a2enmod proxy_balancer;\
a2enmod lbmethod_byrequests
service apache2 restart
Config
config locations: mkdir -p /mnt/d/usr/share/apache2/icons mkdir -p /mnt/d/etc/apache2/conf.sites.all.d
virtual site config: touch /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org{.conf,-le-ssl.conf} touch /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org{.conf,-le-ssl.conf} touch /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com{.conf,-le-ssl.conf} touch /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz{.conf,-le-ssl.conf}
virtual site locations: mkdir -p /mnt/d/var/www/dev.chorke.com/{docs,html,logs,soft} mkdir -p /mnt/d/var/www/dev.shahed.biz/{docs,html,logs,soft} mkdir -p /mnt/d/var/www/{api,dev}.chorke.org/{docs,html,logs,soft} mkdir -p /mnt/d/var/www/dev.chorke.com/html/.well-known/acme-challenge mkdir -p /mnt/d/var/www/dev.shahed.biz/html/.well-known/acme-challenge mkdir -p /mnt/d/var/www/{api,dev}.chorke.org/html/.well-known/acme-challenge
Enable
cd /etc/apache2/sites-enabled/ ln -s /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org.conf 00-dev.chorke.org.conf ln -s /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org.conf 01-api.chorke.org.conf ln -s /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com.conf 02-dev.chorke.com.conf ln -s /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz.conf 03-dev.shahed.biz.conf
cd /etc/apache2/sites-enabled/ ln -s /mnt/d/etc/apache2/conf.sites.all.d/00-dev.chorke.org-le-ssl.conf 00-dev.chorke.org-le-ssl.conf ln -s /mnt/d/etc/apache2/conf.sites.all.d/01-api.chorke.org-le-ssl.conf 01-api.chorke.org-le-ssl.conf ln -s /mnt/d/etc/apache2/conf.sites.all.d/02-dev.chorke.com-le-ssl.conf 02-dev.chorke.com-le-ssl.conf ln -s /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz-le-ssl.conf 03-dev.shahed.biz-le-ssl.conf
Virtual Host configuration skipped to avoid redundancy. Please find the config details in Virtual Host And Certbot in Raspbian 10.
Virtual Host
cat <<EOF >> /mnt/d/etc/apache2/conf.sites.all.d/03-dev.shahed.biz.conf
<IfModule mod_proxy.c>
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes Off
ServerAdmin info<at>shahed.biz
DocumentRoot /mnt/d/var/www/dev.shahed.biz/html
ErrorLog /mnt/d/var/www/dev.shahed.biz/logs/error.log
CustomLog /mnt/d/var/www/dev.shahed.biz/logs/requests.log combined
<Directory "/mnt/d/var/www/dev.shahed.biz/">
AllowOverride None
Require all granted
</Directory>
<Directory "/mnt/d/var/www/dev.shahed.biz/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
Alias /docs "/mnt/d/var/www/dev.shahed.biz/docs/"
<Directory "/mnt/d/var/www/dev.shahed.biz/docs">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
Order Allow,Deny
Allow from all
</Directory>
Alias /logs "/mnt/d/var/www/dev.shahed.biz/logs/"
<Directory "/mnt/d/var/www/dev.shahed.biz/logs">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
Order Allow,Deny
Allow from all
</Directory>
Alias /soft "/mnt/d/var/www/dev.shahed.biz/soft/"
<Directory "/mnt/d/var/www/dev.shahed.biz/soft">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
Order Allow,Deny
Allow from all
</Directory>
<Proxy *>
Order Allow,Deny
Allow from all
Deny from 10.9.8
</Proxy>
# RewriteEngine on
# RewriteCond %{SERVER_NAME} =dev.shahed.biz [OR]
# RewriteCond %{SERVER_NAME} =www.dev.shahed.biz
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
</IfModule>
EOF
PgAdmin4
Package
curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > \
/etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo apt install pgadmin4-web;\
sudo /usr/pgadmin4/bin/setup-web.sh
Manual
apt install python3 python3-pip libgmp3-dev libpq-dev libapache2-mod-wsgi-py3;\
apt install python3-venv;python3 -m venv /mnt/d/var/www/dev.shahed.biz/pgadmin4;\
source /mnt/d/var/www/dev.shahed.biz/pgadmin4/bin/activate
python3 -m pip install -U pip; python3 -m pip install wheel;\
python3 -m pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v5.4/pip/pgadmin4-5.4-py3-none-any.whl
mkdir /var/log/pgadmin4; mkdir -p /var/lib/pgadmin4/{sessions,storage};\
chown -R www-data:www-data /var/{lib,log}/pgadmin4
cat <<EOF >> /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/config_local.py
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
UPGRADE_CHECK_ENABLED = False
SERVER_MODE = True
EOF
python /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/setup.py
: <<'END_COMMENT'
NOTE: Configuring authentication for SERVER mode.
Enter the email address and password to use for the initial pgAdmin user account:
Email address: info<at>shahed.biz
Password:
Retype password:
pgAdmin 4 - Application Initialisation
======================================
END_COMMENT
deactivate
Apache Config:
WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/mnt/d/var/www/dev.shahed.biz/pgadmin4
WSGIScriptAlias /pgadmin4 "/mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/pgAdmin4.wsgi"
<Directory "/mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/">
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
Export Import:
source /mnt/d/var/www/dev.shahed.biz/pgadmin4/bin/activate
python /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/setup.py\
--dump-servers /mnt/c/Users/shahed/Downloads/pgadmin4.json\
--user info<at>shahed.biz
python /mnt/d/var/www/dev.shahed.biz/pgadmin4/lib/python3.8/site-packages/pgadmin4/setup.py\
--load-servers /mnt/c/Users/shahed/Downloads/pgadmin4.json\
--user info<at>shahed.biz
deactivate
Alias Config
# vim /etc/apache2/mods-enabled/alias.conf
<IfModule alias_module>
Alias /icons/ "/mnt/d/usr/share/apache2/icons/"
<Directory "/mnt/d/usr/share/apache2/icons">
Options FollowSymlinks Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /error/ "/usr/share/apache2/error/"
<Directory "/usr/share/apache2/error">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Require all granted
LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
ForceLanguagePriority Prefer Fallback
</Directory>
</IfModule>
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
Auto Index
vim /etc/apache2/mods-enabled/autoindex.conf
<IfModule mod_autoindex.c>
# Directives controlling the display of server-generated directory listings.
#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
# Remove/replace the "Charset=UTF-8" if you don't use UTF-8 for your filenames.
IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* Charset=UTF-8 SuppressDescription SuppressRules FoldersFirst XHTML
IndexStyleSheet /icons/style.css
#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip x-bzip2
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image.gif) image/*
AddIconByType (SND,/icons/sound.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIconByType (HTML,/icons/html.gif) text/html
AddIcon /icons/binary.gif .bin .exe .so .dll
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .7z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps .doc .psd .docx
AddIcon /icons/html.gif .html .shtml .htm .css .xml .xhtml .chm
AddIcon /icons/pdf.gif .pdf
AddIcon /icons/log.gif .log
AddIcon /icons/c.gif .c .cpp .c++ .h
AddIcon /icons/pl.gif .pl
AddIcon /icons/py.gif .py .pyc
AddIcon /icons/spy.gif .spy
AddIcon /icons/php.gif .php
AddIcon /icons/cgi.gif .cgi
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl .cmd .bat
AddIcon /icons/jar.gif .jar
AddIcon /icons/pom.gif .pom
AddIcon /icons/md5.gif .md5
AddIcon /icons/sha1.gif .sha1
AddIcon /icons/tex.gif .tex
# It's a suffix rule, so simply matching "core" matches "score" as well !
AddIcon /icons/bomb.gif /core
AddIcon (SND,/icons/sound.gif) .ogg
AddIcon (VID,/icons/movie.gif) .ogm
AddIcon /icons/back.gif ..
AddIcon /icons/hreadme.gif readme README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/folder.open.gif ^^BLANKICON^^
# Default icons for OpenDocument format
AddIcon /icons/odf6odt-20x22.png .odt
AddIcon /icons/odf6ods-20x22.png .ods
AddIcon /icons/odf6odp-20x22.png .odp
AddIcon /icons/odf6odg-20x22.png .odg
AddIcon /icons/odf6odc-20x22.png .odc
AddIcon /icons/odf6odf-20x22.png .odf
AddIcon /icons/odf6odb-20x22.png .odb
AddIcon /icons/odf6odi-20x22.png .odi
AddIcon /icons/odf6odm-20x22.png .odm
AddIcon /icons/odf6ott-20x22.png .ott
AddIcon /icons/odf6ots-20x22.png .ots
AddIcon /icons/odf6otp-20x22.png .otp
AddIcon /icons/odf6otg-20x22.png .otg
AddIcon /icons/odf6otc-20x22.png .otc
AddIcon /icons/odf6otf-20x22.png .otf
AddIcon /icons/odf6oti-20x22.png .oti
AddIcon /icons/odf6oth-20x22.png .oth
#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
DefaultIcon /icons/unknown.gif
#
# AddDescription allows you to place a short description after a file in
# server-generated indexes. These are only displayed for FancyIndexed
# directories.
# Format: AddDescription "description" filename
AddDescription "Readme File" readme
AddDescription "Core File" core
AddDescription "GZIP compressed document" .gz
AddDescription "GZIP compressed tar archive" .tgz
AddDescription "Tar archive" .tar
AddDescription "Zip Archive" .zip
AddDescription "<a href=\"http://www.apple.com/quicktime/\" title=\"Quicktime\">QuickTime</a> Movie" .mov
AddDescription "<a href=\"http://www.real.com/\" title=\"RealNetworks\">RealNetworks</a> Movie" .ra .ram
AddDescription "Plain-text Document" .txt
AddDescription "Web document" .HTML .xhtml
AddDescription "Compile HTML" .chm .CHM
AddDescription "Document" .ps .ai .eps .pdf .psd .doc .docx
AddDescription "Binary File" .bin .exe .so .dll .pyc .class
AddDescription "Log File" .log
AddDescription "MD5 Digest" .md5 .jar.md5 .pom.md5
AddDescription "SHA1 Digest" .sha1 .jar.sha1 pom.sha1
AddDescription "Java Archive" .jar
AddDescription "Maven pom" .pom
AddDescription "Script" .conf .sh .shar .csh .ksh .tcl .cmd .bat
AddDescription "PHP Script" .php
AddDescription "Perl Script" .pl
AddDescription "Pyhon Script" .py .spy
AddDescription "C Script" .cpp .c++
AddDescription "3D World" .wrl .wrl.gz .vrml .vrm .iv
AddDescription "Icon" .ico
AddDescription "<acronym title=\"Motion Picture Experts Group Audio Layer 3\">MP3</acronym> Audio File" .mp3
AddDescription "<acronym title=\"HyperText Markup Language\">HTML</acronym> Page" .html .htm .shtml
AddDescription "<acronym title=\"Portable Network Graphics\">PNG</acronym> Image" .png
AddDescription "<acronym title=\"Graphics Interchange Format\">GIF</acronym> Image" .gif
AddDescription "<acronym title=\"Joint Photographic Experts Group\">JPEG</acronym> Image" .jpg .jpeg
AddDescription "<acronym title=\"Bitmap\">BMP</acronym> Image" .bmp
AddDescription "<acronym title=\"Extensive Markup Language\">XML</acronym> File" .xml
AddDescription "<acronym title=\"Common Gateway Interface\">CGI</acronym> parsed script" .cgi
AddDescription "<acronym title=\"Cascading Style Sheet\">CSS</acronym> File" .css
#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes
ReadmeName /icons/README.html
HeaderName HEADER.html
#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing. Shell-style wildcarding is permitted.
IndexIgnore .??* *~ *# RCS CVS *,v *,t HEADER.html README.html favicon.ico README cgi-bin
</IfModule>
Error Doc
vim /usr/share/apache2/error/include/top.html
<!--#if expr="-z v('CONTENT_LANGUAGE')"
--><!--#set var="CONTENT_LANGUAGE" value="en"
--><!--#endif
--><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<!--#echo var="CONTENT_LANGUAGE" -->" xml:lang="<!--#echo var="CONTENT_LANGUAGE" -->">
<head>
<title><!--#echo encoding="none" var="TITLE" --></title>
<link rev="made" href="mailto:<!--#echo encoding="url" var="SERVER_ADMIN" -->" />
<link rel="icon" type="image/x-icon" href="/icons/favicon.ico">
<link rel="stylesheet" href="/icons/style.css" type="text/css" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body {
margin: 20%;
}
/*]]>*/-->
</style>
</head>
<body>
<h1><!--#echo encoding="none" var="TITLE" --></h1>
<p>
vim /usr/share/apache2/error/include/bottom.html
</p>
<p>
<!--#include virtual="../contact.html.var" -->
</p>
<h2>Error <!--#echo encoding="none" var="REDIRECT_STATUS" --></h2>
<address>
<a href="/"><!--#echo var="SERVER_NAME" --></a><br />
<span><!--#echo var="SERVER_SOFTWARE" --></span>
</address>
<div align="right">
<a href="https://chorke.org" target="_blank">
<img src="/icons/powered_by_chorke_logo.png" alt="Powered by Chorke, Inc." title="Chorke, Inc." border="0">
</a>
</div>
</body>
</html>
Knowledge
apachectl -t apachectl -M apache2ctl -M
sudo service apache2 restart sudo service postgresql restart sudo service redis-server restart