Nginx Intro
Nginx Intro
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.
Basic Commands
Start Nginx:
bash
Stop Nginx:
bash
Restart Nginx:
bash
1
sudo systemctl restart nginx
Check Status:
bash
Configuration Files
nginx
server {
listen 80;
server_name example.com;
root /var/www/html;
location / {
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;
nginx
upstream myapp {
server backend1.example.com;
server backend2.example.com;
server {
location / {
proxy_pass http://myapp;
Logs