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

Nginx Basics: Server Setup Guide

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)
125 views3 pages

Nginx Basics: Server Setup Guide

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

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/[Link]

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 [Link];

root /var/www/html;

location / {

try_files $uri $uri/ =404;

Reverse Proxy: Forward requests to another server (e.g., an app server like [Link]).

2
nginx

location /app {

proxy_pass [Link]

proxy_set_header Host $host;

Load Balancing: Distribute traffic across multiple servers.

nginx

upstream myapp {

server [Link];

server [Link];

server {

location / {

proxy_pass [Link]

Logs

Access Logs: /var/log/nginx/[Link]

Error Logs: /var/log/nginx/[Link]

You might also like