4.9. Configuration Behind a Reverse Proxy #
You can proxy requests to installed PPEM based on required URL prefixes.
When performing this instruction, consider the following:
nginx is used as a reverse proxy example
/ppemis used as a URL prefix example
To configure PPEM behind a reverse proxy:
On the server where nginx is installed:
In the
httpblock of thenginx.confconfiguration file, specify:map $http_upgrade $connection_upgrade { default upgrade; '' close; }Configure redirection to the
/ppemURL prefix.For example, in
/etc/nginx/sites-enabled/default, specify:server { listen 80 default_server; root /var/www/html; server_name _; location /ppem/ { rewrite ^/ppem/(.*)/\$1 break; proxy_pass http://127.0.0.1:8080/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $http_host; } location / { return 404; } }Reload nginx:
systemctl reload nginx
For more information, refer to the official nginx documentation.
On the server where the manager is installed:
In the
ppem-manager.ymlmanager configuration file, specify:frontend: PPEM_API_PREFIX: /ppem PPEM_FRONTEND_BASENAME: /ppem
In
usr/share/ppem/web-app/index.html, replace<base href="/" />with<base href="/ppem/" />.Restart PPEM:
restart ppem
On the servers where agents are installed:
In the
ppem-agent.ymlagent configuration file, add the/ppemURL prefix to theagent.manager.urlparameter value.This value is specified in the
scheme://manager_network_address/path_to_API_versionformat. You must add the URL prefix between/manager_network_address/and/path_to_API_version.For example, if the current value is
https://example.postgrespro.com/v1, the updated value must behttps://example.postgrespro.com/ppem/v1.Restart the agent:
systemctl restart ppem-agent
(Optional) To enable nginx to download reports of the required size, in the
http,server, orlocationdirective, specify theclient_max_body_size:parameter.report_size_in_MBs;For example, in the
serverdirective, specify:server { listen 80 default_server; root /var/www/html; server_name _; client_max_body_size 100M; .... }In this case, the maximum report size is 100 MB.