[NGINX] Redirect homepage to different route

This is a quick and lazy way of doing this that doesn’t touch nginx configs, but works reliably.

When I visit my server’s domain, by default it would show me the “welcome to nginx” page. A bit lame honestly.

To change that, All I did was:

  1. rename the /var/www/index.nginx-debian.html to index.nginx-debian.html.old

  2. replaced it with a new index.nginx-debian.html which contained a single line of HTML:
    <meta http-equiv="Refresh" content="0; url='destination/url/here'" /> and saved it.

You can confirm this works by heading to your server’s domain root and confirming it instantly redirects you.

Could you do this in nginx configs? sure. But this is much easier and intuitive imo.

You can just create index.html it takes priority before default nginx html.

1 Like

Or you create a Nginx configuration that will redirect all request on a specific domain to a specific target location. Similar to what Apache vhost does.