OTRS behind nginx reverse proxy

Moderator: crythias

Post Reply
robertsuszek
Znuny newbie
Posts: 3
Joined: 06 Nov 2018, 13:30
Znuny Version: 6.0.12-01
Real Name: Robert
Company: Thomas IT

OTRS behind nginx reverse proxy

Post by robertsuszek »

Hello,

I am experiencing troubles setting up an OTRS behind nginx reverse proxy, I manage to connect to the OTRS, but all the logos are missing, and login page displays this message: Przeglądarka której używasz jest zbyt stara. This software runs with a huge lists of browsers, please upgrade to one of these. Zajrzyj do dokumentacji lub zapytaj o szczegóły swojego administratora.

(Polish sentences translate to: The browser you are using is too old. This software runs with a huge lists of browsers, please upgrade to one of these. Take a look into docs or ask your administrator for details.)

When I am using local url (without going through proxy), everything is fine and both index.pl and customer.pl loads perfectly fine.

After hours of googling my best bet is that nginx isn't parsing .pl scripts responses (or requests?) properly and thus everything but html isn't loading to the client.

Here's
my nginx reverse proxy setting:

Code: Select all

ssl_certificate  /etc/nginx/ssl/rpwildcard.crt;
ssl_certificate_key  /etc/nginx/ssl/rpwildcard.key;
ssl_session_timeout  5m;
ssl_prefer_server_ciphers  on;
ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers  AES256+EECDH:AES256+EDH:!aNULL;

server  {
  listen  80;
  server_name  *.mydomain.pl;
  return 301 https://$host$request_uri;
}

server  {
  listen  443 ssl;
  server_name mydomain.pl;
  ssl  on;
  location  / {
    return  404;
  }
}

server  {
  listen  443 ssl;
  server_name gateway.mydomain.pl;
  ssl  on;
  location  / {
    proxy_pass https://gateway.mydomain.local/;
  }
}

server  {
  listen  443 ssl;
  server_name app1.mydomain.pl;
  ssl  on;
  location  / {
    proxy_pass https://app1.mydomain.local/;
  }
}

server  {
  listen  443 ssl;
  server_name client.otrs.mydomain.pl;
  ssl  on;
  location  / {
    proxy_pass https://otrs.mydomain.local/otrs/customer.pl;
  }
}

server  {
  listen  443 ssl;
  server_name agent.otrs.mydomain.pl;
  ssl  on;
  location  / {
    proxy_pass https://otrs.mydomain.local/otrs/index.pl;
  }
}
I've changed real domain names for obvious purpose. mydomain.local is available only internally for all servers within my LAN, mydomain.pl is available on the internet.

My question is: How should I configure nginx, so it will serve as a proxy for OTRS?
robertsuszek
Znuny newbie
Posts: 3
Joined: 06 Nov 2018, 13:30
Znuny Version: 6.0.12-01
Real Name: Robert
Company: Thomas IT

Re: OTRS behind nginx reverse proxy

Post by robertsuszek »

I have found sample configuration file for apache under /opt/otrs/scripts/apache2-httpd-plack-proxy.conf, but everything is set up on nginx already, and I would like to stay with it.
robertsuszek
Znuny newbie
Posts: 3
Joined: 06 Nov 2018, 13:30
Znuny Version: 6.0.12-01
Real Name: Robert
Company: Thomas IT

Re: OTRS behind nginx reverse proxy

Post by robertsuszek »

I have resolved the problem, the log message from error.log on nginx described everything:

Code: Select all

2018/11/06 09:36:46 [error] 11699#0: *11464 open() "/usr/share/nginx/html/otrs-web/skins/Agent/default/img/icons/product.ico" failed (2: No such file or directory), client: 10.0.1.1, server: client.otrs.mydomain.pl, request: "GET /otrs-web/skins/Agent/default/img/icons/product.ico HTTP/1.1", host: "client.otrs.mydomain.pl"
This states, that nginx is trying to access /otrs-web/ folder locally, not forwarding the requests to otrs server. I have adjusted proxy settings, so that requests to /otrs-web/ would be proxied otrs server to /otrs-web/ folder.

Code: Select all

server  {
  listen  443 ssl;
  server_name client.otrs.mydomain.pl;
  ssl  on;
  location  / {
    proxy_pass https://otrs.mydomain.local/otrs/customer.pl;
  }

  location /otrs-web {
    proxy_pass https://otrs.mydomain.local/otrs-web/;
  }
}
Everything works fine for now!
Post Reply