Forward a port with NGINX

Sxribe

I am trying to forward an python application to a directory. I know I worded this badly, let me try and explain it better

What I currently have:

NGINX on port 80 Static HTML files on /var/www/html

Python API on port 5500 localhost:5500/apiEndpoint (for example)

How can I change it so if I go to localhost:80/api/apiEndpoint it gives me localhost:5500/apiEndpoint ?

Thank you for your help :)

Raul

If you want to do a mask of that location, you can try:

server {
    listen 80;
    listen [::]:80;
    root /var/www/html;
    server_name domain.com;

    location ~ ^/api/apiEndpoint/(.*)$ {
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:5500/apiEndpoint/$1;
    }
}

Hope i understood your question correctly.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related