I have following configuration, it works really well if I put instance DNS name as server name. But if I use the ALB DNS name as server_name, and if I try to access it with the ALB address, it just displays the default nginx page.

cat /etc/nginx/conf.d/tomcat.conf
server {
    listen 80;
    listen [::]:80;
    server_name tomcat-8554.us-east-2.elb.amazonaws.com www.tomcat-8554.us-east-2.elb.amazonaws.com;
    location / {
            proxy_redirect      off;
            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;
            proxy_set_header    Host $host;
            proxy_pass          http://localhost:8080;

Any idea?


I was able to resolve the issue by restarting nginx. As I have added the configuration in user data, I was under impression that the config change will happen even before starting nginx service, it seems it was not the case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.