How to Change Default Index Page on Nginx


In this tutorial you will learn how to change the default index page after installing nginx. When you install nginx, the default page is a simple index html file that says " Welcome to Nginx" .

If you want to change this file, you can do so by following the steps in this tutorial

Where is the index file located?

The index file is located on /var/www/html, to change this file you can replace it with your own index.html file or simply edit the current one by using any text editor or any other file transfer software ie filezilla.

Step 1 - Login to your Server

Login to your server via SSH

ssh [email protected]

Step 2 - Go to Html Directory

Next go to the html directory where the index file is located, browse into the html directory by using the cd command

cd /var/www/html

Once you are inside the html directory, there are multiple ways to change or edit this file.

1)You can edit the index file directly from the terminal by using any text editor such as : nano or vim

sudo nano index.html

Once you are done with the changes, press CTRL + X to save changes.

2) Uploading the file(s) via FTP/SFTP

To do this you can add your server to filezilla and connect to it using the sftp protocol, then simply browse to the same path as shown above and then simply upload your files.

Host - Put your Server's IP

Username - Your username

Password - Your Password

Port - In this case we are using sftp protocol so the port is 22, then click Quickconnect button to login to your server

As shown in the screenshot below, make sure you are in the directory - /var/www/html, then drag and drop files you want to upload into this directory.

3) You can also use FTP protocol to upload files with filezilla, all you need to do is change the 22 port to the FTP port (21) and then click the quickconnect button.

I wouldn't recommend using ftp over ssh, however if you don't have access to ssh then ftp might be the only way.

Step 3 - Restart Nginx

If you still see the default page even after editing or replacing it, restart nginx and try again

sudo systemctl restart nginx


In this tutorial you learned where the default Nginx page is located and how to change it by using any text editor, or by simply using an software like filezilla.