What is a proxy?
In its simplest form, a proxy is a server that listens for requests and redirects them to other servers. This allows multiple servers to run on the same system but still receive their requests, such as the case with many large hosting servers today. Requests are redirected depending on how they were made to the machine such as the URL that was used.
Proxies can also provide other benefits such as distributing traffic among multiple instances of the same web server, formatting the requests such as adding additional headers, filtering requests, or adding an additional security layer.
What is NGINX
NGINX is a popular web server that is commonly used for proxying requests. It was designed for performance and stability. It can perform many tasks efficiently such as being a web server itself for static content, load balancing, content caching, SSL/TLS terminator, or proxying requests.
Configuring NGINX
NGINX configuration can get complex because of all of the features available. The following is a basic setup for getting started with. This configuration will listen for requests being made on port 80 with a specific URL and forward them on to a server listening on port 8080.
|
|
Next we will want to get NGINX running on our local server. This is easily done using docker compose and an existing image. The image expects the configuration file created in the previous step to be placed in the templates folder in the same directory.
|
|
Checking configuration
You can check for proper configuration by running a curl
command on your local machine and verifying that a proper response is received.
|
|