Create new default file for nginx

To create a new default file for Nginx, you'll need to create a new configuration file in the sites-available directory and then create a symbolic link to it in the sites-enabled directory.

Here are the steps:

Step 1: Create a new configuration file

Create a new file in the sites-available directory, for example, default-new.conf. You can use a text editor like nano or vim to create the file:

sudo nano /etc/nginx/sites-available/default-new.conf

Step 2: Add the configuration

Add the following configuration to the file:

server {
    listen 80;
    server_name example.com;

    location / {
        root /var/www/html;
        index index.html index.htm;
    }
}

This configuration sets up a new server block that listens on port 80, serves files from the /var/www/html directory, and uses index.html and index.htm as default index files.

Step 3: Create a symbolic link

Create a symbolic link to the new configuration file in the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/default-new.conf /etc/nginx/sites-enabled/

Step 4: Restart Nginx

Restart Nginx to apply the changes:

sudo service nginx restart

Step 5: Test the new default file

Test the new default file by accessing your server's IP address or domain name in a web browser. You should see the default index file served by Nginx.

That's it! You've created a new default file for Nginx.