@deron
To redirect HTTP to HTTPS in Nginx on Ubuntu, you can follow these steps:
1
|
sudo nano /etc/nginx/sites-available/default |
1 2 3 4 5 |
server { listen 80; server_name your_domain.com; return 301 https://$server_name$request_uri; } |
Replace your_domain.com with your actual domain name.
1
|
sudo nginx -t |
1
|
sudo systemctl reload nginx |
Now, when users access your website using HTTP, they will be automatically redirected to HTTPS.