0% found this document useful (0 votes)
9 views3 pages

Nginx Intro

Nginx is a high-performance web server and reverse proxy that serves static content, directs client requests to back-end servers, and improves load balancing and security. It includes basic commands for starting, stopping, and checking the status of the server, as well as configuration files for server blocks and load balancing. Logs for access and errors are stored in specific directories for monitoring and troubleshooting.

Uploaded by

Nagaraj M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Nginx Intro

Nginx is a high-performance web server and reverse proxy that serves static content, directs client requests to back-end servers, and improves load balancing and security. It includes basic commands for starting, stopping, and checking the status of the server, as well as configuration files for server blocks and load balancing. Logs for access and errors are stored in specific directories for monitoring and troubleshooting.

Uploaded by

Nagaraj M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Here's a quick guide to understanding the basics of Nginx, a powerful, high-performance web

server and reverse proxy:

What is Nginx?

Web Server: It can serve static content like HTML, CSS, JavaScript, and images.

Reverse Proxy: Directs client requests to back-end servers, improving load balancing and
security.

Load Balancer: Distributes traffic across multiple servers for scalability.

Content Caching: Boosts performance by caching frequently used files.

Basic Commands

Start Nginx:

bash

sudo systemctl start nginx

Stop Nginx:

bash

sudo systemctl stop nginx

Restart Nginx:

bash

1
sudo systemctl restart nginx

Check Status:

bash

sudo systemctl status nginx

Configuration Files

Default configuration file: /etc/nginx/nginx.conf

Virtual Host configuration: Located in /etc/nginx/sites-available/ and symlinked to


/etc/nginx/sites-enabled/.

Key Configuration Directives

Server Block: Used to configure specific websites or services.

nginx

server {

listen 80;

server_name example.com;

root /var/www/html;

location / {

try_files $uri $uri/ =404;

Reverse Proxy: Forward requests to another server (e.g., an app server like Node.js).

2
nginx

location /app {

proxy_pass http://127.0.0.1:3000;

proxy_set_header Host $host;

Load Balancing: Distribute traffic across multiple servers.

nginx

upstream myapp {

server backend1.example.com;

server backend2.example.com;

server {

location / {

proxy_pass http://myapp;

Logs

Access Logs: /var/log/nginx/access.log

Error Logs: /var/log/nginx/error.log

You might also like