Welcome! Log In Create A New Profile

Advanced

Internal application - Publish on nginx

December 03, 2021 07:37AM
Hi people.

I am configuring Nginx to publish my Internal portal.

My portal is hosted on my server https://x.x.x.x:8443

the principal url of this protal is https://x.x.x.x:8443/pwm/private/login. This URL I don't need to publish.

inside this portal I have another URL that I would like to publish. see below.

https://x.x.x.x:8443/pwm/public/forgottenpassword

I've tried to use the configuration below.

##########################NGINX CONFIGURATION#########################

upstream myapp {
server x.x.x.x:8443;
}

server {
server_tokens off;
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec/main.conf;

listen 443 ssl;
listen 80;
server_name x.x.x.x.com;
ssl_prefer_server_ciphers On;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;

# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;

ssl_certificate /etc/nginx/ssl/wildcard-fullchain.pem; # wildcard ca full chain certificate
ssl_certificate_key /etc/nginx/ssl/wildcard-key.pem; # wildcard private certificate

client_max_body_size 5M;

root /var/www/;
index index.html;


if ($scheme != "https") {
rewrite ^ https://$http_host$request_uri? permanent;
}

location ^~ /.well-known/pki-validation/ {
allow all;
root /var/www/;
default_type "text/plain";
try_files $uri =404;
}



location /app {
proxy_pass https://myapp/pwm/public/forgottenpassword;
#rewrite ^/(.*)/pwm/public$ /$1 break;
proxy_redirect default;
proxy_set_header Host $host;
}


access_log /var/log/nginx/access.log myAccess;
error_log /var/log/nginx/error.log;
}

##########################END CONFIGURATION####################

When I do this, the /app does not work but when try internally the address https://x.x.x.x:8443/pwm/public/forgottenpassword it works like expected.

I am working on this for a long time without any result.

Thank you in advance for the help.
Subject Author Posted

Internal application - Publish on nginx

agomes December 03, 2021 07:37AM

Re: Internal application - Publish on nginx

Francis Daly December 03, 2021 08:36AM

Re: Internal application - Publish on nginx

agomes December 03, 2021 09:02AM

Re: Internal application - Publish on nginx

Francis Daly December 03, 2021 09:36AM

Re: Internal application - Publish on nginx

agomes December 03, 2021 10:05AM

Re: Internal application - Publish on nginx

Francis Daly December 03, 2021 11:02AM

Re: Internal application - Publish on nginx

agomes December 03, 2021 11:34AM

Re: Internal application - Publish on nginx

agomes December 03, 2021 12:57PM

Re: Internal application - Publish on nginx

Francis Daly December 04, 2021 03:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 53
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready