Nginx redirect HTTP to HTTPS

Nginx redirect HTTP to HTTPS

To redirect the traffic from HTTP to HTTPS you can put this

Edit /etc/nginx/sites-available/default

server {
listen 80;
server_name infinitynetwork.ro www.infinitynetwork.ro;
return 301 https://$server_name$request_uri;
.....

Save, exit, and restart the server:

sudo systemctl restart nginx

Leave a Reply

Your email address will not be published.

Loading