nginx server is showing 502 Bad Gateway after instaaing tomcat8

September 18, 2015 670 views
Nginx Ubuntu

I am using ajenti V for server panel. on it I used nginx php5 which is working properly now recently I installed tomcat 8 in my server through command line and added script to nginx 's conf.d directory now
problem is nginx server is showing 502 Bad Gateway error how to resolve this?

I have added /etc/nginx/nginx.d/tomcat.conf

server {
  listen          80;

#  proxy_cache one;

  location / {
        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;
        proxy_set_header X-Forwarded-Host $host;

1 comment
  • Seems that perhaps some convention is employed on these droplets (I cannot recall from where I am referencing the source of this info..), but I found that I was trying to edit my /etc/nginx/sites-available/default whilst the real working config was actually under /etc/nginx/mydomain.com.conf. As soon as I changed this conf, my issues were resolved. Hope this helps.

Be the first one to answer this question.