Skip to main content

Install Nginx

Table of Contents

Introduction

In this Section we learn to install nginx on a V Server and create a alternative Start Website for your V Server on the Web.

Prerequisites:

You need a Ubuntu Cloud VM to setting your VServer.

Login to your V-Server

  1. Update Respoitories on your Server.

    sudo apt update" 
  2. Install Nginx on your Server. Use the following command:

    sudo apt install nginx -y

Create-alternatvie-Webseite and install nginx

  1. Crearte Alternative html side for your nginx Serrver:

    1. Create a new Directory
    mkdir -p /var/www/alternatives
    1. Create a new HTML file:
    sudo touch /var/www/alternatives/alternate-index.html
    1. Add a new configuration to:
    sudo nano /etc/nginx/sites-enabled/alternatives
    1. Open File
    2. Add:
      server {
      listen 8081;
      listen [::]:8081;

      root /var/www/alternatives;
      index alternate-index.html;git

      location / {
      try_files $uri $uri/ =404;
      }
    3. Save this file and close it.
    4. Open the new html file.
    sudo nano var/www/alternatives/alternate-index.html
    1. Take your HTML Code into this file.
    2. Save and Close this file.
    3. Open your new Website on
      your_ip>:8081