502 Bad Gateway Issue - Using Nginx and Jenkins - nginx

I'm facing a problem with one server mine. I have a configuration of a Jenkins application running under Nginx in a Ubuntu OS.
But after updating Jenkins to a new version, when I try to reach my Jenkins web application, I get this error:
"502 Bad Gateway - nginx/1.14.0 (Ubuntu)"
Apparently all my configuration are okay.
How can I solve it?
Nginx error log:
2019/04/24 16:20:02 [error] 11424#11424: *2 connect() failed (111: Connection refused) while connecting to upstream, client: yyy.yy.yyy.yy, server: xx.xx.xxx.xxx, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "xx.xx.xxx.xxx", referrer: "http://xx.xx.xxx.xxx/"

Related

How to deploy multiple .net core projects in a single elastic beanstalk server?

I have a single solution with 2 projects - https://github.com/vickyrathee/dotnet-test-app
My Website: dotnet-test-website (domain.com)
My API: dotnet-test-api (api.domain.com)
How can I configure my projects to be deployed on single Ubuntu/Amazon linux server?
I already tried using the Urls option on appsettings.json to set port 5001 for API project and 5002 for website project as mentioned here
https://github.com/vickyrathee/dotnet-test-app/blob/master/dotnet-test-app/appsettings.json
{
"Urls" : "http://localhost:5001"
}
But as per the EB logs, it seems to trying port 5000 instead what I defined in appsettings.json
----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2021/02/14 09:11:24 [error] 3583#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.10.146, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "172.31.26.188"
2021/02/14 09:11:39 [error] 3583#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.10.146, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "172.31.26.188"
2021/02/14 09:11:54 [error] 3583#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.10.146, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "172.31.26.188"
Additionally, how to publish it correctly in separate folders, So that there are no conflict between them. EB allow single zip file upload with appsettings.json on root, while I have two with some other files as well in common and can't just put them on single directory to zip. Any help will be appreciated.

How to config nginx about proxy_pass?

I run tomcat and my nginx.conf like this
If in http://127.0.0.1:8080/edu/b.html or http://192.168.0.102:8080/edu/b.html it's ok
If in http://192.168.0.102:9001/edu/b.html it can't work
my computer ip now is 192.168.0.102
error message
[error] 17810#17810: *12 connect() failed (111: Connection refused) while connecting to upstream, client: 192 .168.0.102, server: 192.168.0.102, request: "GET /edu/b.html HTTP/1.1", upstream: "http://127.0.0.1:8000/edu/b.html", host: "192. 168.0.102:9001"
Where is error? What should I do?
It is trying to connect to http://127.0.0.1:8000/edu/b.html(upstream) instead of http://192.168.0.102:8080/edu/b.html. You need to change the upstream port in your nginx.conf

What nginx server config exactly should be for Nuxt.js Universal project?

I've got big troubles with deploy my nuxt.js project on Ubuntu with Nginx;
Ubuntu 18.04 + nginx
Nuxt.js 2.3.2 (universal mode)
So maybe somebody can help me to resolve my problem)
I will to describe all things around this problem below:
My nuxt.conf build part
My nginx config
Then I run this command in ssh
sudo npm run build
sudo pm2 start npm --name "nuxt" -- start
Now server is listening localhost:3000, as I wrote in package.json
After all this I've got 500 error in console, when I open my site.
Server error
nginx error.log
2018/11/26 04:48:42 [error] 15032#15032: *5773 upstream prematurely closed connection while reading response header from upstream, client: 173.267.244.9, server: example.com, request: "GET /seller HTTP/1.1", upstream: "http://127.0.0.1:3000/seller", host: "example.com"
2018/11/26 04:48:42 [error] 15032#15032: *5773 connect() failed (111: Connection refused) while connecting to upstream, client: 173.267.244.9, server: example.com, request: "GET /seller HTTP/1.1", upstream: "http://[::1]:3000/seller", host: "example.com"
2018/11/26 04:48:43 [error] 15032#15032: *5773 no live upstreams while connecting to upstream, client: 173.267.244.9, server: example.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://localhost/favicon.ico", host: "example.com", referrer: "http://example.com/seller"
So now I have no idea whats wrong with that. Help me please.
It seems that Nginx tries to connect on the IPv6 loopback [::1], and nodejs is probably just listening on IPv4.
Try setting 127.0.0.1 instead of localhost

Upgrading Ghost Broke My Website

My ghost blog was running fine and i've just tried to upgrade it using the guide posted here. I am using Digital Ocean as the web host by the way.
After upgrade it's showing some problems, I've looked at the error log and it's showing a bunch of errors like this:
2015/09/07 13:22:50 [error] 3987#0: *23 connect() failed (111: Connection refused) while connecting to upstream, client: (IP HIDDEN), server: my-ghost-blog.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:2368/favicon.ico", host: "HOST HIDDEN", referrer: "http://URL HIDDEN/"
I've removed IPs and what not
Since nobody has answered it I might as well post what worked for me. I was able to start the blog manually with npm start it was just the service ghost start that reported [OK] but didn't actually start it.
First I was able to find the error in /var/log/nginx/errors.log
2016/02/08 21:18:27 [error] 601#0: *2086 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: my-ghost-blog.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:xxxx/favicon.ico", host: "mydomain.com", referrer: "http://example.com/path-to-post/"
I had to recursively change the owner of /ghost directory like this:
chown -R ghost:ghost ghost/*
I executed it from /var/www
thanks to #BrettDeWoody for his post

HHVM stops working, (111: Connection Refused) message on Nginx with PageSpeed

I've recently set up a WordPress blog on a VPS with Ubuntu 12.04 LTS, HHVM, Nginx (with the PageSpeed module included), and MariaDB. Everything runs really fast, but in the last few days I've noticed that HHVM stops working suddenly and from that moment the error.log shows first this message:
2014/09/18 12:27:56 [error] 24442#0: *121276 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 150.146.136.21, server: xxxxx.com, request: "POST /wp-login.php?PageSpeed=noscript HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "xxxxx.com"
and then several messages with URLs corresponding to articles people are trying to read, but always with a 111 error:
2014/09/18 14:03:28 [error] 24442#0: *133594 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.78.121, server: xxxxx.com, request: "GET /2008/11/27/thanksgiving-whatever/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.xxxx.com"
I'd say it has something to do with the PageSpeed module, but why is HHVM affected and not Nginx? DO you have some hint?
Thank

Resources