{"id":23910508,"url":"https://github.com/nikoo-asadnejad/nginx-config","last_synced_at":"2026-05-16T06:37:43.922Z","repository":{"id":270710998,"uuid":"911234381","full_name":"Nikoo-Asadnejad/NGINX-Config","owner":"Nikoo-Asadnejad","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-12T19:16:58.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T17:13:36.411Z","etag":null,"topics":["docker-compose","nginx","nginx-configuration","nginx-docker","nginx-docker-image","nginx-proxy","nginx-reverse-proxy"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nikoo-Asadnejad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-02T14:48:00.000Z","updated_at":"2025-01-12T19:17:01.000Z","dependencies_parsed_at":"2025-01-02T15:47:51.739Z","dependency_job_id":null,"html_url":"https://github.com/Nikoo-Asadnejad/NGINX-Config","commit_stats":null,"previous_names":["nikoo-asadnejad/nginx-config"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikoo-Asadnejad%2FNGINX-Config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikoo-Asadnejad%2FNGINX-Config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikoo-Asadnejad%2FNGINX-Config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikoo-Asadnejad%2FNGINX-Config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nikoo-Asadnejad","download_url":"https://codeload.github.com/Nikoo-Asadnejad/NGINX-Config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240347981,"owners_count":19787237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","nginx","nginx-configuration","nginx-docker","nginx-docker-image","nginx-proxy","nginx-reverse-proxy"],"created_at":"2025-01-05T07:17:01.276Z","updated_at":"2025-11-14T06:31:26.223Z","avatar_url":"https://github.com/Nikoo-Asadnejad.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advanced Nginx Reverse Proxy with Load Balancing\n\nThis project provides a comprehensive configuration for Nginx as a reverse proxy with advanced features such as load balancing, caching, compression, rate limiting, and enhanced security. It supports both HTTP and HTTPS traffic, with HTTPS termination, custom error pages, and more.\n\n---\n\n## Features\n\n- **Reverse Proxy**: Forward client requests to backend servers.\n- **Load Balancing**: Distribute traffic among multiple backend servers with support for:\n  - Round Robin (default)\n  - Least Connections\n  - IP Hash (sticky sessions)\n- **SSL/TLS Support**: Secure connections with strong SSL/TLS configuration.\n- **HTTP/2 Support**: Improved performance for modern web clients.\n- **Caching**: Configurable caching for improved performance.\n- **Rate Limiting**: Protect backend servers from abusive requests.\n- **Compression**: Gzip compression for reduced bandwidth usage.\n- **Security Headers**: Protect against common web vulnerabilities.\n- **Custom Error Pages**: Enhanced user experience for error handling.\n\n---\n\n## Prerequisites\n\n1. **Nginx Installed**:\n   ```bash\n   sudo apt update\n   sudo apt install nginx -y\n   sudo systemctl start nginx\n   sudo systemctl enable nginx\n\n## Installation:\n\n### Edit Nginx Configuration  : \n  Create a new configuration file for the reverse proxy and copy the configs in it.\n```bash\nsudo nano /etc/nginx/sites-available/load-balanced-reverse-proxy\n```\n\n###  Enable the Configuration :\n```bash\nsudo ln -s /etc/nginx/sites-available/load-balanced-reverse-proxy /etc/nginx/sites-enabled/\n```\n\n### Test and Restart or Reload Nginx : \n```bash\nsudo nginx -t\nsudo systemctl restart nginx\nsudo systemctl reload nginx\n```\n\n### Check Nginx Status :\n```bash\nsudo systemctl status nginx\n```\n\n### Review Logs : \n```bash\nsudo tail -f /var/log/nginx/*.log\n```\n\n---------------------------------------------------------------------------------\n# Run It with Docker \n\n## Run the container with volumes :\nYou can run the Nginx container with a volume mount to use your custom configuration without rebuilding the image:\n```bash\ndocker run -d \\\n  --name nginx-proxy \\\n  -p 80:80 -p 443:443 \\\n  -v ~/nginx-config/load-balanced-reverse-proxy.conf:/etc/nginx/conf.d/default.conf:ro \\\n  -v ~/nginx-config/ssl:/etc/ssl:ro \\\n  -v ~/nginx-config/html:/var/www/html:ro \\\n  nginx:latest\n```\n\n## Use the Docker file for having custom image :\nNeeds rebuilding the image each time and it's not recommended.\n\n## Use the Docker Compose.\n\nRun the container:\n\n```bash\ndocker-compose up -d\n```\n\nCheck that the container is running:\n```bash\ndocker ps\n```\n\nTest the configuration inside the container:\n```bash\ndocker exec -it nginx-proxy nginx -t\n```\n\nAccess the Nginx logs for debugging:\n```bash\ndocker logs nginx-proxy\n```\n\nIf you make changes to your Nginx configuration, reload it without restarting the container:\n```bash\ndocker exec -it nginx-proxy nginx -s reload\n```\n\n --------------------------------------------------------------------------------\n\n### Load Balancing Methods :\nLoad Balancing Methods in Nginx\n\n1.\tRound Robin (default):\n\t-\tDistributes client requests evenly across all available backend servers.\n\t-\tSuitable for general-purpose load balancing without specific session persistence needs.\n2.\tLeast Connections:\n\t-\tSends traffic to the backend server with the fewest active connections.\n\t-\tIdeal for scenarios where servers have uneven processing capacities or traffic spikes.\n3.\tIP Hash:\n  -\tRoutes requests from the same client IP to the same backend server (sticky sessions).\n\t-\tUseful when session persistence is required, such as with stateful applications.\n\n### Custom Error Pages :\n```bash\necho \"Page not found.\" | sudo tee /var/www/html/custom_404.html\necho \"Something went wrong.\" | sudo tee /var/www/html/custom_50x.html\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikoo-asadnejad%2Fnginx-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikoo-asadnejad%2Fnginx-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikoo-asadnejad%2Fnginx-config/lists"}