what is the nginx configuration needed for go app to listen 80 as reverse proxy ?
Hi @muhammed.ihsan ,
In the main.go
file, the web page is configured to listen on port 8081
and we need to configure it in a way with Nginx as a reverse proxy for GoApp to access the application on port 80
.
Simply follow the below steps: -
Configure Nginx as a reverse proxy:
sudo vi /etc/nginx/nginx.conf
Add below given line under location
directive in server block and save the changes:
proxy_pass http://127.0.0.1:8081;
and after that make sure to restart the nginx service:
sudo systemctl restart nginx
Regards,
It worked like a charm, Thank you so much.
Can you please explain how you did it? I am not sure where to enter “proxy_pass http://127.0.0.1:8081;”
and also after running command “sudo systemctl restart nginx”, lab shows connection closed. what should be done in that case?
Add below given line under location
directive in server block and save the changes:
proxy_pass http://127.0.0.1:8081;
Hello @Tej-Singh-Rana , from the task we were requested to reverse-proxy the server to allow access in port 80, why did you use 8081? Looking forward to your prompt response.
Hello Everyone!
the first left box (Bob’s box), have the description [ bob is able to login into GoApp using username “test” and password “test” ].
Even after configure the nginx and the box became green after the validation, I still didn’t figure it out how to validate it my self.
Did any of you have the opportunity to make such validation?
Thank you very much!
Regards!
Raul.