502 Bad Gateway

See at https://github.com/zammad/zammad/issues/1945

I had checked this out and it seemed that your Zammad is not running at all.

Could you try

cd /opt/zammad
rails s -p 3000

And post your nginx configuration here for me to see.

/opt/zammad/bin/rails s -p 3000 gives

/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /opt/zammad/config/boot.rb:3:in `<top (required)>'
	from /opt/zammad/bin/rails:3:in `require_relative'
	from /opt/zammad/bin/rails:3:in `<main>'

ssl-zammad.conf of nginx:

this is the SSL nginx config for zammad

upstream zammad{
server localhost:3000;
}upstream zammad-websocket {
server localhost:6042;
}

#server {
#listen 80;
#return 301 https://$host$request_uri;
#}

server {
listen 80;
listen [::]:80;
server_name domain.de www.domain.de;
access_log /var/log/nginx/domain.de.access.log;
error_log /var/log/nginx/domain.de.error.log;
location /.well-known/ {
root /var/www/html;
}
location / {
rewrite ^/(.*)$ https://domain.de/$1 permanent;
}
}

server {
listen 443 http2 ssl;server_name domain.de www.domain.de;root /opt/zammad/public;ssl_certificate /etc/letsencrypt/live/domain.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.de/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_prefer_server_ciphers on;
ssl_ciphers “EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH”;
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/ssl/lets-encrypt-x3-cross-signed.pem;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security “max-age=63072000; includeSubdomains”;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;access_log /var/log/nginx/zammad.access.log;
error_log /var/log/nginx/zammad.error.log;client_max_body_size 50M;location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
expires max;
}location /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 86400;
proxy_pass http://zammad-websocket;
}location / {
proxy_set_header Host $http_host;
proxy_set_header CLIENT_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 180;
proxy_pass http://zammad;gzip on;
gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application$
gzip_proxied any;
}
}

Nope. Try the above.

-bash: rails: Kommando nicht gefunden

You need to be in /opt/zammad first before executing rails s -p 3000

so you need to cd /opt/zammad then run rails s -p 3000

I am in this directory…

oh sorry. how about bin/rails s -p 3000

Gives:
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler/setup (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in require’
from /opt/zammad/config/boot.rb:3:in <top (required)>' from bin/rails:3:in require_relative’
from bin/rails:3:in `’

ah. ok. :bulb:

type in gem install bundler && bundle install

Says:
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
1 gem installed
Don’t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Could not locate Gemfile

After restart of zammad still 502.

you’re not running the commands as the zammad user

sudo -iu zammad
cd /opt/zammad
bundle install 

I think that’s why rails s -p 3000 didn’t work in the first place. You were running as root user and not zammad user

[zammad@xxx zammad]$ gem install bundler && bundle install
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
1 gem installed
Your Ruby version is 2.0.0, but your Gemfile specified 2.4.2

[quote=“chrstmnn, post:9, topic:531”]
bin/rails s -p 3000
[/quote] brings

[zammad@xxx zammad]$ bin/rails s -p 3000
Your Ruby version is 2.0.0, but your Gemfile specified 2.4.2

Sounds like you have a version of ruby that comes with CentOS.

Can you run as root:

yum remove ruby

then as zammad user, run rails s -p 3000 in /opt/zammad

[zammad@xxx ~]$ cd /opt/zammad
[zammad@xxx zammad]$ rails s -p 3000
-bash: rails: Kommando nicht gefunden.
[zammad@xxx zammad]$ bin/rails s -p 3000
/usr/bin/env: ruby: Datei oder Verzeichnis nicht gefunden

ls /usr/local/bin/ruby

does it exist?

If it doesn’t you will need to reinstall zammad, yum reinstall zammad

Dir not found…

I´ll try to reinstall now

Reinstall was successful, but still 502 :frowning:

@chrstmnn I had basically run CentOS to get a better understanding on the problem.

as zammad user:

/usr/bin/zammad run web

Just to be sure that there are no errors