How To Set Up HTTPS For A Website On Ubuntu
Prerequisites: You must set up the following first: A website hosting server. See How To Set Up Website Hosting On Ubuntu.
Context:Domain name: yourdomain.comHostname: bluedroplet.yourdomain.comUsername: alexSteps: Get a SSL certificate.You can get a free SSL certificate by the following steps: SSH into your server.ssh alex@bluedroplet.yourdomain.comInstall the Certbot client.sudo apt-get install letsencrypt -yGet a SSL certificate for your site using the letsencrypt command.sudo letsencrypt certonly --webroot -w ~/sites/yourdomain.com/public -d yourdomain.com
- The -w flag should point to your site’s public directory. - The -d flag is the domain you’re requesting the certificate for.
- You should be prompted to enter your email address, which will be used for expiration notices. - You'll see the following message on success, showing the certificate location.
Install the SSL certificate.Edit the site’s Nginx configuration file.sudo nano /etc/nginx/sites-available/yourdomain.com Remove…
Install the SSL certificate.Edit the site’s Nginx configuration file.sudo nano /etc/nginx/sites-available/yourdomain.com Remove…