Posts

Showing posts with the label web server

Using Nginx on Docker

Image
Introduction Nginx is a popular open-source web server known for its superior performance compared to the Apache web server. Nginx supports various functionalities, including deploying an API gateway (reverse proxy) , load balancer , and email proxy . It was initially developed to build a web server capable of efficiently handling 10,000 concurrent connections with low memory usage. Run Nginx with Docker To use Nginx with Docker , simply execute the following command: docker run -dp 8080:80 nginx:alpine By default, Nginx uses port 80 , but you can map it to a different port if needed. Custom Nginx Configuration To customize the Nginx configuration, first, create a ` docker-compose.yml ` file with the following content: services : serviceName : image : nginx:alpine ports : - 8080:80 volumes : - ./default.conf:/etc/nginx/conf.d/default.conf - ./index.html:/usr/share/nginx/html/index.html In the ` volumes ` field, note that I have mapped two file...