- Choose Ubuntu Server
- Configure security group
- ssh: 22
- http: 80
- https: 443
- Create Keypair
Personal-Web-KeyPair.pem
and Download to local
- Terminal (local):
ssh -i "Personal-Web-KeyPair.pem" [email protected]
- Package update:
sudo apt-get update
- Install apache2:
sudo apt-get install apache2
- Check status:
sudo systemctl status apache2
- Restart apache2:
sudo systemctl restart apache2
- Browser check link:
ec2-Public-IPv4-DNS.compute-1.amazonaws.com
showing apache2 website
- Register a domain name
guowenbin.com
. (I usedNamecheap.com
personally) cd /etc/apache2/sites-available/
, modify000-default.conf
-
<VirtualHost *:80>
ServerName: guowenbin.com
ServerAlias www.guowenbin.com
-
<VirtualHost *:443>
ServerName: guowenbin.com
ServerAlias www.guowenbin.com
ServerAdmin: emailAddress
SSLCertificateFile ~/personalWeb.crt
SSLCertificateKeyFile ~/server.key
SSLCertificateChainFile ~/personalWeb.ca-bundle
-
Log directory error:
No such file or directory: AH02291: Cannot access directory '/etc/apache2/$/home/ubuntu/log/
mkdir /var/log/apache2
chmod 750 /var/log/apache2
chown root:adm /var/log/apache2
solution from plesk
-
cd /var/www/html/
, updateindex.html
-
Purchase PositiveSSL and issue to the primary domain
-
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
to get key and CSR code
CSR code start with-----BEGIN CERTIFICATE REQUEST-----
-
SSL certificate: a) active ssl, b) enter CSR code, primary domain, c) DCV method: add CNAME record
-
Receive an email contains two files:
personalWeb.ca-bundle
andpersonalWeb.crt
-
Setup Advanced DNS
Type Host Value TTL A Record @ IPv4 address 5 min CNAME Record www ec2-Public-IPv4-DNS.compute-1.amazonaws.com 5 min CNAME Record www guowenbin.com 5 min CNAME Record Host from ssl check namecheap tutorial Automatic CNAME Record Host.www target from ssl check namecheap tutorial Automatic URL Redirect Record @ https://guowenbin.com DO NOT forget this Redirect