[solved] Zammad Redirect to Https

  • Used Zammad version: 2.8.0
  • Used Zammad installation source: package
  • Operating system: Ubuntu 18.04

I know this is NGINX configuration but after i read some tutorials how to redirect website to https but is not work for me,

Requesting for your help how can I configured zammad in nginx to redirect to https I already installed comodo certificate and working but i need to type the https:// to load the website.
I want is I only type the domain then automatic load to https.

Thank you in advance and God Bless

Hi,

open you zammad.conf and add the following line

return 301 https://zammad.domain.com;

server {
    listen 80;

    server_name zammad.domain.com;
    return 301 https://zammad.domain.com;
}

When you now enter zammad.domain.com into you Browser, the Request will redirected to https.

Don’t forget to restart Nginx.

I already tried that config… and restart the nginx… still cant redirect to https :pensive::pensive::pensive:
After you hit enter only loading then it will show that cant reach the server… but when i type the https it will connect and working properly

Yeah well your nginx does also needs to listen to port 443 (SSL) and have a config for that. :slight_smile:

Here’s a link to our sample config file that you need to edit for your setup to work as expected, you can even insert/merge it with your existing configuration:

Sir @MrGeneration below is my nginx config but still cant redirect to https… and please advise if my ssl and other security (add_header) is only ok to zammad system…
thank you

Im using comodo certificate

server {
listen 80;
server_name domain.com;
return 301 https://$host$request_uri;
}

server {
listen 443;

# replace 'localhost' with your fqdn if you want to use zammad from remote
server_name domain.com;

ssl on;
ssl_certificate /etc/nginx/ssl/certificate/cert.crt;
ssl_certificate_key /etc/nginx/ssl/certificate/key.key;
ssl_prefer_server_ciphers on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/ssl/certificate/cert.crt;
resolver 8.8.4.4 4.2.2.2 valid=300s;
resolver_timeout 10s;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";

root /opt/zammad/public;

Please provide the error message.
Can you access Zammad via HTTPs directly without any problems?

nginx’s erorr log should give you a hint in case it’s not working at all.

If I typed only is the domain name. Ex. zammad.domain.com the browser error is This site can,t be reached (Google Chorme) but i also try in other browsers same problem cant view the website,

To work I need to type also the https://zammad.domain.com

Ensure that the ports 80 and 443 are open, sounds like they’re closed.

Just as an additional reference, Here is my zammad.conf for nginx. It listens on both IPV4 and IPV6 and uses letsencrypt SSL certificate.

upstream zammad-railsserver {
    server 127.0.0.1:3000;
}

upstream zammad-websocket {
    server 127.0.0.1:6042;
}

server {

    # replace 'localhost' with your fqdn if you want to use zammad from remote
    server_name helpdesk.domain; 

    root /opt/zammad/public;

    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_set_header X-Forwarded-Proto $scheme;
        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_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300;
        proxy_pass http://zammad-railsserver;

        gzip on;
        gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
        gzip_proxied any;
    }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/helpdesk.domain/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/helpdesk.domain/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
    if ($host = helpdesk.domain) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    listen [::]:80;
    server_name helpdesk.domain;
    return 404; # managed by Certbot


}
1 Like

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