502 Bad Gateway nginx

Infos:

  • Used Zammad version: 4.10
  • Used Zammad installation type: package
  • Operating system: Centos 7
  • Browser + version: Firefox

Expected behavior:

  • Login page should come up

Actual behavior:

  • 502 Bad Gateway (nginx)

Steps to reproduce the behavior:

  • restarting everything, access Zammad

I already read posts about getting the sudden error “502 Bad Gateway” from nginx, but nothing helped me so far. All of a sudden, after a node restart zammad is not accessible anymore, and reacts with a 502 Bad Gateway message.

The thing is : the nginx log complains about “111: Connection refused while connecting to upstream” and upstream: “http://127.0.0.1:3000/” , but there is nothing running or listening on port 3000

All zammad service (seen with systemctl status) are Up. So what service should be accessible on port 3000?

thanks.

Same problem here - I also found an error with Ruby class Digest::SHA1. But I can’t remember in which log I found it.

EDIT:

The error was given when I tried to exec zammad run rails r “Setting.set(‘es_user’, ‘’)”

error log:

Traceback (most recent call last):
30: from /opt/zammad/bin/rails:8:in <main>' 29: from /opt/zammad/bin/rails:8:in require_relative’
28: from /opt/zammad/config/boot.rb:3:in <top (required)>' 27: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’
26: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 25: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/setup.rb:10:in <top (required)>’
24: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler.rb:101:in setup' 23: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler.rb:135:in definition’
22: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:34:in build' 21: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/dsl.rb:13:in evaluate’
20: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/dsl.rb:234:in to_definition' 19: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/dsl.rb:234:in new’
18: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:120:in initialize' 17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:674:in converge_sources’
16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:104:in replace_sources!' 15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:85:in lock_sources’
14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:85:in sort_by' 13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:85:in each’
12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:76:in to_s' 11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:225:in revision’
10: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:299:in git_proxy' 9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:216:in cache_path’
8: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:321:in git_scope' 7: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:287:in uri_hash’
6: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:225:in digest' 5: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:98:in Digest’
4: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:98:in synchronize' 3: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:100:in block in Digest’
2: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:17:in const_missing' 1: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’
/opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require': libcrypto.so.1.0.0: cannot open shared object file: No such file or directory - /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/x86_64-linux/digest/sha1.so (LoadError) 28: from /opt/zammad/bin/rails:8:in
27: from /opt/zammad/bin/rails:8:in require_relative' 26: from /opt/zammad/config/boot.rb:3:in <top (required)>’
25: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require' 24: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in require’
23: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/setup.rb:10:in <top (required)>' 22: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler.rb:101:in setup’
21: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler.rb:135:in definition' 20: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:34:in build’
19: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/dsl.rb:13:in evaluate' 18: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/dsl.rb:234:in to_definition’
17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/dsl.rb:234:in new' 16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:120:in initialize’
15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:674:in converge_sources' 14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:104:in replace_sources!’
13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:85:in lock_sources' 12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:85:in sort_by’
11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source_list.rb:85:in each' 10: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:76:in to_s’
9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:225:in revision' 8: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:299:in git_proxy’
7: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:216:in cache_path' 6: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:321:in git_scope’
5: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/source/git.rb:287:in uri_hash' 4: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:225:in digest’
3: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:98:in Digest' 2: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:98:in synchronize’
1: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:100:in block in Digest' /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/digest.rb:16:in const_missing’: library not found for class Digest::SHA1 – digest/sha1 (LoadError)

Did you run these commands?

SELinux

https://docs.zammad.org/en/latest/install/package.html#selinux

that helped, thanks a lot! My solution was to run

$ chcon -Rv --type=httpd_sys_content_t /opt/zammad/public/
$ setsebool httpd_can_network_connect on -P
$ semanage fcontext -a -t httpd_sys_content_t /opt/zammad/public/
$ restorecon -Rv /opt/zammad/public/
$ chmod -R a+r /opt/zammad/public/

This alone didn’t help. But after a reboot I could login again…

By running “chcon -Rv --type=httpd_sys_content_t /opt/zammad/public/” as root I get a lot of errors:

chcon: can’t apply partial context to unlabeled file ‘assets’
changing security context of ‘/opt/zammad/public/403.html’

Anyway I ran the other commands and did a reboot, but still getting error 502, because 127:0.0.1:3000 is not reachable. What did I do wrong?

I assume this is in the context of SELinux. Try to disable it (temporarily) and see what happens

Thank you for the very fast reply. I don’t have SElinux installed, should I do so?

Nobody wonders why Zammad is not reachable on port 3000?

If ss -tulpen|grep "3000" does not return processes then the service is not running the way it should.
But the service runs? → stop the Zammad service and remove the pid directory: rm -rf /opt/zammad/tmp/pids/ (ONLY DO THIS IF NOT RUNNING)

Start the service.
Zammad should start to listen to the port in question.

Thank you for your response. ss -tulpen|grep "3000" says that port 3000 is not in use. So I tried to do what you described but /opt/zammad/tmp/pids/ does not exist on my system. There where only found folders like cache, sockets, cache_file_store_production and websocket_production.

Maybe the backup I tried to restore is corrupted?

Ensure you followed the required restore steps:
https://docs.zammad.org/en/latest/appendix/backup-and-restore.html#migrating-from-another-zammad-host

I did all the steps exactly according to the instuctions. Maybe it helps if I only delete the /opt/zammad folder and reinstall zammad but keeping the database and nginx conf?

if you don’t have your files in the storage you could try that.
However, I can’t help you further at this point and wouldn’t suggest it.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.