Skip to content

Instantly share code, notes, and snippets.

@piyushgarg-dev
Last active June 26, 2024 05:39
Show Gist options
  • Save piyushgarg-dev/b2085fad5400ec71840c2e8b7d782d44 to your computer and use it in GitHub Desktop.
Save piyushgarg-dev/b2085fad5400ec71840c2e8b7d782d44 to your computer and use it in GitHub Desktop.
Nginx Installation

Video Tutorial: https://youtu.be/Qmld1te08Ns

Nginx Ubuntu Installation

Update Packages

sudo apt-get update

Install Nginx

sudo apt-get install nginx

Verify Installation

sudo nginx -v

Start Nginx Server

nginx

Now visit http://localhost:80 and you would be able to see default nginx welcome page.

Nginx Docker Installation

Run Docker Ubuntu Image

docker run -it -p 8080:80 ubuntu

Update Packages

sudo apt-get update

Install Nginx

sudo apt-get install nginx

Verify Installation

sudo nginx -v

Start Nginx Server

nginx

Now visit http://localhost:8080 and you would be able to see default nginx welcome page.

Nginx Conf File

Install VIM

sudo apt-get install vim

Open nginx.conf file

vim etc/nginx/nginx.conf

Type Sample Nginx Conf

events {
}

http {
  server {
    listen 80;
    server_name _;
    
    location / {
      return 200 "Hello from Nginx Sever";
    }
  }
}

Reload Nginx

nginx -s reload

Visit localhost:8080 or localhost:80 and you should see Hello from Nginx Sever on browser.

@abhishek1savaliya
Copy link

sudo is not working

@kartiksaxena532
Copy link

sudo is not working

dont use it on windows use it on mac😂

@abhishek1savaliya
Copy link

sudo is not working

dont use it on windows use it on mac😂

😀😀😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment