NGINX Reverse Proxy Location and Path

NGINX can be easily used as a reverse proxy. To do this you simply need to modify the nginx.conf file and add what you would like to proxy. You can proxy whatever URL you want, either the base, or something else

[root@centos03 conf]# vi /opt/nginx/conf/nginx.conf

And add lines within the HTTP -> Server sections

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        
        location /some/path/ {
                proxy_pass http://WhateverURLYouWant/;
        }
        

This will take anything coming to http://hostname/some/path and reverse proxy whatever URL you want! How cool. Really simple and performs well.