ELMA365 On-Premises > Other > Configuration / Configure Nginx for the Service Portal

Configure Nginx for the Service Portal

This article shows an example of configuring Nginx to access a Service Portal at a designated domain name using a reverse proxy.

начало внимание

Before you start, you need to enable and activate a Service Portal.

конец внимание

We also recommend configuring Nginx for ELMA365 with a reverse proxy based on the instructions in the Configure Nginx to use ELMA365 behind a reverse proxy article.

The following data is used in the example:

  • /_portal/orders. Name of the workspace with an activated portal.
  • portal-elma365client.domain.com. The Service Portal domain name.
  • elma365client.domain.com. The ELMA365 application domain name.
  • 192.168.1.10. IP address of the server with the ELMA365 application.

Here is an example of reverse proxy configuration to access a Service Portal at a designated domain with Nginx:

server { 
   listen 80; 
   server_name portal-elma365client.domain.com; 
   return 301 https://$server_name$request_uri; 
}
 
server { 
listen 443 ssl http2; 
server_name portal-elma365client.domain.com;
ssl_certificate /etc/letsencrypt/live/portal-elma365client.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/portal-elma365client.domain.com/privkey.pem;
 
proxy_http_version                 1.1;
proxy_cache_bypass                 $http_upgrade;
 
proxy_set_header Upgrade           $http_upgrade;
proxy_set_header Connection        "upgrade";
proxy_set_header Host              $host;
proxy_set_header X-Real-IP         $remote_addr;
proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
 
proxy_set_header Accept-Encoding "";
sub_filter_types *;
sub_filter_once off;
sub_filter 'elma365client.domain.com' 'portal-elma365client.domain.com';
 
location / {
    return 301 /_portal/orders;
}
location = /index.html {
    return 301 /_portal/orders;
}
location /_portal/orders {
    proxy_pass                         http://192.168.1.10/_portal/orders;
}
location ~* ^.+.(jpg|jpeg|gif|png|svg|ico|js|woff|woff|woff2|css|po)$ {
    proxy_pass                         http://192.168.1.10;
}
location /ws {
    proxy_pass                         http://192.168.1.10;
}
location /api {
    proxy_pass                         http://192.168.1.10;
}
location /s3elma365 {
    proxy_pass                         http://192.168.1.10;
}
location /guard {
    proxy_pass                         http://192.168.1.10;
}
location /assets {
    proxy_pass                         http://192.168.1.10;
}
}

During installation or reconfiguration, in the Enter host field, specify elma365client.domain.com as the external domain that ELMA365 will be available at and enable SSL termination.

начало внимание

The following parameters are required for the web sockets in the application to work correctly:

  • proxy_http_version 1.1.
  • proxy_set_header Upgrade $http_upgrade.
  • proxy_set_header Connection "upgrade".

The sub_filter directive will only work if ngx_http_sub_module is enabled in Nginx.

конец внимание

Found a typo? Highlight the text, press ctrl + enter and notify us