Turning HTTP to HTTPS

n00🔑
3 min readMay 31, 2024

Example- Converting python3 simple HTTP server to HTTPS

Note: Any HTTP server can be used

Prerequisites-

a. Domain

b. Computer with public IP

  1. Configuring domain DNS-

We need to add a “A” record pointing to the IP of the server where HTTP server is running.

2. Getting SSL certificate

certbot certonly --standalone -d pdfmerge.work -m <your email> --agree-tos

2. Configuring nginx-

The default nginx config file is located at

/etc/nginx/nginx.conf

this config includes different configs(as you can see in below screenshot)-

So it is better not to touch this default config file. Let’s add our custom config separately in /etc/nginx/sites-enabled/* -


#server {
# listen 80;
# server_name pdfmerge.work;
#
# # Redirect all HTTP requests to HTTPS
#…

--

--