Welcome! Log In Create A New Profile

Advanced

Problem setting up a simple reverse proxy

Posted by Richie79 
Problem setting up a simple reverse proxy
February 03, 2019 12:07PM
I'm a Nginx noob and trying to set up just a simple reverse proxy to secure my IP camera which doesn't support SSH natively. I have installed Nginx in my Raspberry Pi (Raspbian OS) and Nginx seems to run just fine.

I have deployed Raspberry in my camera network which is separated from other sub-nets and has access to Internet only. I have set Raspberry static IP and it is able to connect to Internet fine.

For testing purposes I try to set Nginx to listen to port 123. Camera's current port is 1234. I have made necessary port forwardings from my firewall and router to Raspberry and to both of these ports currently (after Nginx works, I won't need the port forwarding to camera's current port 1234).

Command: 'systemctl status nginx.service' tells Nginx status is "active (running)" and I'm able to see the default Nginx web page with browser. So Nginx and default setting seems to work okay.

Problem occurs when I try to follow instructions found on various sites of how to set up reverse proxy in front of IP camera.

Firstly I'd like try to see if Nginx proxy simply works by testing basic HTTP traffic.
If I have understood various instructions correctly, setting up basic HTTP reverse proxy should be very simple and script I have tried to use is below:

server {
listen 123; #Port I try to set up for Nginx to listen to and forward.
location / {
proxy_pass http://192.168.0.123:1234; #IP and port my camera currently has.
}
}

To my understanding, when this script is pasted into correct configuration file and in correct place it should be enough. I have tried to include the script always at the beginning of the file. Problem is that I am unsure where to save the script and I have tried various places with no success. Whenever I edit files found in different instructions and then try to access the camera afterwards in desired reverse proxy port, I am unable to.

Instructions found in here: https://security.stackexchange.com/questions/56779/securing-remotely-accessible-ip-cameras-that-do-not-support-https
tells to edit configuration file found in here: /etc/nginx/conf.d/default.conf

Problem is that there is no default.conf file found in that path. I can of course create it, and I actually also did, but it did nothing.

One config file can be found from path: /etc/nginx/nginx.conf
I tried to edit that file as well and paste the script into that, but it still does nothing.

Instructions found in here: https://www.raspberrypi.org/forums/viewtopic.php?t=34291
suggest to edit the config file found in here: /etc/nginx/sites-enabled/default

I also tried to edit that file and include the script at the beginning of the file, but still no success. I also tried to create a new text file with the previous script in that particular path, but still no success.

After each saved command I have rebooted Nginx and verified that status has returned to "active (running)". Still no success. I've ran out of ideas and could really need some help. Could someone please help a guy out? It's probably not a big problem at all. Thanks a lot.



Edited 4 time(s). Last edit at 02/03/2019 12:16PM by Richie79.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready