Recently, I wrote a new blog server as my personal blog website. However, I want it to support Https
protocol not the insecure Http
protocol.
So I do some research and find the resolution.
- Install
nginx
andmkcert
- create certification:
mkcert heng30.xyz "*.heng30.xyz" localhost 127.0.0.1 ::1
- configure nginx configuration
/etc/nginx/nginx.conf
:
server {
listen 443 ssl;
server_name heng30.xyz;
ssl_certificate path-to-certification.pem;
ssl_certificate_key path-to-private-key.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
# location / {
# proxy_pass http://127.0.0.1:80/;
# }
}
- restart
nginx
:systemctl status nginx.service
- maybe setup the DNS record on your DNS provider configuration page
Enjoy your nginx
server using the https
protocol.