Open akhila1518 opened 1 week ago
Hello @akhila1518 , where is the new project for the reverse nginx proxy asked? and the diagram? We need this before proceed to create the pipeline. please, create a folder on the root called nginx_reverse_proxy with the Docker compose, docker file, diagrams, and all the needed files. Provide evidence that solution is running. Here a example but stick on what was instruced please
Here another article that help explain what is a nginx reverse proxy.
Hi @edipoferreira i have completed the task. Please check on akhila1518/Devops--Training -1/ master folder. I have committed all the required files and folders. kindly check and let me know if any changes required. Thank you.
@akhila1518 I did a test and is not working, tried to validated the nginx.conf but have a error, belo the testing
root@5b962dacf39b:/etc/nginx# cat nginx.conf
http {
upstream backend {
server nginx1:80;
server nginx2:80;
}
server {
listen 80;
location /pageone {
proxy_pass http://nginx1;
}
location /pagetwo {
proxy_pass http://nginx2;
}
location / {
proxy_pass http://backend;
}
}
}
root@5b962dacf39b:/etc/nginx# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2024/10/22 01:12:21 [emerg] 62#62: no "events" section in configuration
nginx: [emerg] no "events" section in configuration
nginx: configuration file /etc/nginx/nginx.conf test failed
root@5b962dacf39b:/etc/nginx#
This is the error on docker compose:
nginx_reverse_proxy-1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx_reverse_proxy-1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx_reverse_proxy-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx_reverse_proxy-1 | 10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
nginx_reverse_proxy-1 | /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
nginx_reverse_proxy-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx_reverse_proxy-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
nginx_reverse_proxy-1 | /docker-entrypoint.sh: Configuration complete; ready for start up
nginx_reverse_proxy-1 | 2024/10/22 01:07:02 [emerg] 1#1: no "events" section in configuration
nginx_reverse_proxy-1 | nginx: [emerg] no "events" section in configuration
nginx_reverse_proxy-1 exited with code 1
@akhila1518 after fix, please, test with curl and provide evidences, so I can validate locally as well.
You will create a solution that will have
A nginx reverse proxy two backed nginx servers. the nginx reverse proxy will be the one that will be exposed, when access localhost/pageone request will be for container nginx 1, when access localhost/pagetwo, request will be for nginx container 2 nginx1 and nginx 2 both will have a index.html showing the name of each container, container one, container two.
And when access localhost the nginx reverse proxy will balance the connection between container one and container two, when access using browser or curl it will show the container one page index.html or the container two page index.html
Feel free to use gpt to better understand this, but take in mind, you need understand very well the arquitecture.
Also:
This is a basic but at same time high level project that will prepare you to more advancend things related to kubernetes for example.