Setting up Reverse Proxy with Namecheap

naq90 nginx-forum at nginx.us
Tue Dec 22 00:29:37 UTC 2015


I'm running a site on my local network which I would like to access via a
reverse proxy to a domain I purchased on namecheap. I'm using nginx on my
freenas machine. The site is running locally at 192.168.1.7:8080. I do not
know if my conf is correct or how to set up namecheap so that I can go to
mysite.mydomain.com or mydomain.com/mysite. Any help would be greatly
appreciated. Below is the conf I made.

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen      80;
        server_name www.mydomain.com;
 
        location /mysite {
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://192.168.1.7:8080;
 }
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }
    }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,263618,263618#msg-263618



More information about the nginx mailing list