Configure Nginx redirect www to non-www and vice versa

Configure Nginx redirect www to non-www and vice versa

There are many ways to force Nginx using url has www or non-www. I would like to introduce a simple way follows: Redirect non-WWW to WWW Edit nginx configuration file (/etc/nginx/nginx.conf): Single domain server { server_name example.com; return 301 $scheme://www.example.com$request_uri; } All domains server { server_name “~^(?!www\.).*” ; return 301 $scheme://www.$host$request_uri; } From WWW to non-WWW Single […]

Configure Nginx redirect HTTP to HTTPS

Configure Nginx redirect HTTP to HTTPS

Currently the demand of using security protocol SSL for websites are quite popular because Google has increased the importance of ranking for this site. After installing the SSL success, how to redirect all url from HTTP to HTTPS with the nginx, please refer to this tutorial. Edit nginx configuration file (/etc/nginx/nginx.conf). Add or modify the […]