Install and Configure Nginx as an LBR

Jo ! Can you check out my result, please. I got task failed, but all worked fine I was able to get response from each servers verified connectivity from loadbalancer to each httpd service.
I can repeat this exercise if you wish but I am pretty sure smth is wrong with verification. Additionally my lab broke and I had to restart exercise maybe this caused an issue.

1 Like

Sorry to hear that. We will check and get back to you.

Hi @andrzej, you were right. There was an issue with the validation. We have fixed that now. Your task has been marked successful. Thank you for your patience.

2 Likes

@mmumshad : I also received below output

Task Status - Failed

php-fpm service is not running on App Server 1 php-fpm service is not running on App Server 2 php-fpm service is not running on App Server 3 website is not setup correctly as its not working on LBR URL

Although i could get output below when checked using Host1 option

PHP Test Welcome to xFusionCorp Industries !'; ?>

Could you pls look into it

Hi, guys!
Please help with this challenge
Day by day traffic is increasing on one of the websites managed by the Nautilus production support team. Therefore, the team has observed a degradation in website performance. Following discussions about this issue, the team has decided to deploy this application on a high availability stack i.e on Nautilus infra in Stratos DC. They started the migration last month and it is almost done, as only the LBR server configuration is pending. Configure LBR server as per the information given below:
a. Install nginx on LBR (load balancer) server.
b. Configure load-balancing with the an http context making use of all App Servers.
c. Also make sure Apache service is up and running on all app servers.
d. Once done, you can access the website using StaticApp button on the top bar.

nginx installed on lbr server

/etc/nginx/nginx.conf edited with load balancer

http {
log_format main '$remote_addr - $remote_user [$time_local] “$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘“$http_user_agent” “$http_x_forwarded_for”’;

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

upstream backend {
          server stapp01.stratos.xfusioncorp.com;
          server stapp02.stratos.xfusioncorp.com;
          server stapp03.stratos.xfusioncorp.com;
}
server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    #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://backend;
    }

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

status nginx Active: active (running)
status httpd on all app server are running
but with curl I get ERROR that port 80 refused
curl: (7) Failed to connect to 172.16.238.10 port 80: Connection refused

You are missing the ports. What port is the apache service listening on for each app server?

1 Like

thanks a lot @mohamed-e
I found this later and now it’s done

Best regard

pls, help me with the same task - level 4 linux - Install and Configure Nginx as an LBR.

i think i have done it right, i do see the “welcome to xfusion corp industries”

here is some screenshots:

on all 3 app servers, in httpd.conf

Screenshot_58
Screenshot_57

and on stlb load balancer:


what’s wrong?

This looks like a validation error, but the app works with the expected response (Welcome to XFusionCorp Industries!)
image

I even tried with just the app server names (without FQDN) and also by their IP’s, all got validation checks failed.
cc @mohamed-e @mmumshad @Tej-Singh-Rana

I tried your configuration (just the proxy part) in the main nginx configuration and it worked. Note in the main nginx configuration there is a listener on the ipv6 port as well which you don’t have.

Ok, I have added the lipv6 listener too .

upstream myapp1 {
server stapp01:6300;
server stapp02:6300;
server stapp03:6300;
}

server {
listen 80;
listen [::]:80;
location / {
proxy_pass http://myapp1;
}
}

The validation still fails @al1

Where are these changes being made?

inside /etc/nginx/conf.d/lbr.conf

That will be conflicting with the configuration in /etc/nginx/nginx.conf

Yeah, it worked for me now, after making the changes directly inside nginx.conf file itself.

But when I did the change inside conf.d/lbr.conf, I made sure I commented out the same settings in the nginx.conf file and on top of it, we get the desired result expected, when we click on the App button on top right side.

But no issues, validation is now successful, thanks @al1 for your insights.

this is my failing screen recorder - whats wrong? pls help

You do not change the configuration at all on the app servers. All configuration is done on the load balancer server Re read this thread, you will see you are missing the ports that the application servers are running on. They are not running on port 80.

1 Like

yes! thxn, its done now!