- Published on
Configuring Nginx Reverse Proxy
book1 minute
The Reverse Proxy method is useful for covering the API endpoints we create. It's quite similar to my previous post on Kong Gateway. A Reverse Proxy acts as an intermediary between the client and the server, receiving requests from the client, forwarding them to the appropriate server, and then returning the server's response back to the client.
Create the api-proxy.conf
File
Create a new file api-proxy.conf
in the /etc/nginx/conf.d
directory
$ sudo nano /etc/nginx/conf.d/api-proxy.conf
Save the file
Restart Nginx
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo service nginx reload
So, when accessing the server on port 80 at http://{hostname}, it will be access to http://{hostname}:3000
That’s it, see ya~