computers:apache_server_configuration
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
computers:apache_server_configuration [2018/12/17 11:44] – chkuo | computers:apache_server_configuration [2022/11/02 16:04] (current) – chkuo | ||
---|---|---|---|
Line 92: | Line 92: | ||
</ | </ | ||
+ | |||
+ | ===== Update ===== | ||
+ | |||
+ | <code bash> | ||
+ | # for Ubuntu 20.04.5 LTS; 2022/11/02 | ||
+ | # to update beyond Apache/ | ||
+ | $ apache2 -v | ||
+ | Server version: Apache/ | ||
+ | Server built: | ||
+ | $ sudo add-apt-repository ppa: | ||
+ | $ sudo apt update | ||
+ | $ sudo apt install apache2 | ||
+ | $ apache2 -v | ||
+ | Server version: Apache/ | ||
+ | Server built: | ||
+ | $ systemctl status apache2 | ||
+ | $ sudo systemctl start apache2 | ||
+ | $ sudo systemctl enable apache2 | ||
+ | </ | ||
===== Password protection ===== | ===== Password protection ===== | ||
Line 115: | Line 134: | ||
* install: | * install: | ||
<code bash> | <code bash> | ||
- | $ sudo apt-get update | + | # require snapd; pre-installed on Ubuntu 20.04 |
- | $ sudo apt-get | + | # remove the pre-installed cerbot (if present) |
- | $ sudo add-apt-repository universe | + | $ sudo apt remove certbot |
- | $ sudo add-apt-repository ppa: | + | # install certbot using snap |
- | $ sudo apt-get update | + | $ sudo snap install --classic certbot |
- | $ sudo apt-get install python-certbot-apache | + | # get a certificate; |
+ | # (1) get a certificate without changing the Apache configuration | ||
+ | $ sudo certbot certonly | ||
+ | # (2) get a certificate and have certbot edit the Apache configuration | ||
+ | $ sudo certbot | ||
+ | # | ||
+ | # check status | ||
+ | $ sudo systemctl status certbot.timer | ||
+ | # test renewal | ||
+ | $ sudo certbot renew --dry-run | ||
+ | # manual renewal; not recommended | ||
+ | # better to put '/ | ||
+ | $ sudo certbot renew | ||
+ | # enable ssl | ||
+ | $ sudo a2enmod ssl | ||
</ | </ | ||
* modify ''/ | * modify ''/ | ||
Line 127: | Line 160: | ||
ServerAdmin admin@example.com | ServerAdmin admin@example.com | ||
</ | </ | ||
- | * execute | ||
- | <code bash> | ||
- | $ sudo certbot --apache | ||
- | </ | ||
+ | * SSL test: [[https:// | ||
===== PHP ===== | ===== PHP ===== | ||
==== Info ==== | ==== Info ==== | ||
Line 204: | Line 234: | ||
sudo htpasswd -c / | sudo htpasswd -c / | ||
# change the ownership and permissions | # change the ownership and permissions | ||
- | sudo chown www-data:admin / | + | sudo chown www-data:adm / |
sudo chmod 640 / | sudo chmod 640 / | ||
# backup the vhost configuration | # backup the vhost configuration | ||
Line 239: | Line 269: | ||
==== References ==== | ==== References ==== | ||
+ | * [[https:// | ||
* [[https:// | * [[https:// | ||
computers/apache_server_configuration.1545018274.txt.gz · Last modified: 2018/12/17 11:44 by chkuo