V
V
vlarkanov2018-10-18 10:05:15
linux
vlarkanov, 2018-10-18 10:05:15

Nginx: how to forward requests to a different port (within the same server)?

Hello. There is a service that accepts requests on port 8081. How can I configure nginx to listen on port 8080 and proxy requests to port 8081 to the application, logging the requests themselves to access.log?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2018-10-18
@vlarkanov

server {
    listen 0.0.0.0:8080;
    access_log /path/to/access_log
    location / {
        proxy_pass http://127.0.0.1:8081/;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question