-
Install Docker
-
Install node.js
for linux, use the following command:curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejsor run below script:
chmod +x nodejs_download.sh ./nodejs_download.sh
-
Install docker-compose
-
Clone this repository
-
Run
docker-compose up --build -din the terminal -
Access the application at
http://localhost:3001 -
To stop the application, run
docker-compose down
- The Nginx configuration file is located at
nginx/default.conf - The default server listens on port 80 and proxies requests to the backend server on port 3000
- The backend server is defined in the
docker-compose.ymlfile
– Handles general connection processing, including connection limits and worker processes. Essential for managing incoming client connections.
– Governs HTTP traffic, covering web requests, proxying, caching, and load balancing.
– Manages email-related traffic, including SMTP, IMAP, and POP3 proxying.
– Handles TCP and UDP traffic, useful for managing low-level networking like database connections and custom protocols.
- The
eventsmodule is responsible for handling connections and managing worker processes.
– Specifies the IP address and port where the server will accept requests (e.g., listen 80; for HTTP or listen 443 ssl; for HTTPS).
– Defines the domain or IP address the server should respond to (e.g., server_name example.com www.example.com;).
Determines how specific request types (like certain URLs or file types) should be handled. For example:
1. location /images/ {} can handle all requests under /images/.
2. location ~* \.(jpg|png|gif)$ {} can handle image files.
Forwards requests to another server or service, typically used for load balancing or reverse proxying. For example:
1. proxy_pass http://backend:3000; forwards requests to the backend server on port 3000.
2. proxy_pass http://localhost:8080; forwards requests to a local service on port 8080.
Defines backend servers to which Nginx forwards requests (e.g., an application server like Node.js, Django, or a database).
Comes from the direction of data flow; requests move "upstream" from Nginx to the backend.
Handle requests from clients by forwarding them to an application or database server.
The traffic flowing back from the upstream servers to the client is called "downstream."
