Lab- Linux Challenge 2

i have issue with the challenge-2 as i can’t create Configure Nginx as a reverse proxy for the GoApp so that we can access the GoApp on port “80” , Add firewall rules to allow only incoming port “22”, “80” and “8081”. even if i configured all as below

cat /etc/nginx/conf.d/goapp.conf
server {
listen 80;
server_name 192.168.114.160; # Replace with your IP/domain

location / {
    proxy_pass http://localhost:8081;  # Forward to GoApp
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

}

firewall configuration as below :

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-port=8081/tcp
sudo firewall-cmd --reload

I’m not sure exactly where you’re going wrong, but we do have the solution for the challenge in a github repo; Challenge 2’s solution is here. For the nginx configuration,

    server {
        listen       80;
        listen       [::]:80;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location = / {
            proxy_pass  http://localhost:8081;
        }

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

which is a bit simpler than your solution.

Thanks rob for your clarification . Appreciated