Installed nginx and tried to do reverse proxy but now I can not see mjpg_streamer, what am I doing wrong?

What is the problem?
I am new to all this, so I installed buster on raspberry pi 4B.
installed octoprint on buster by following these directions:

got down to the part about using reverse proxy, so I decided I wanted nginx server to do this. But I am now lost, somehow I can no longer see mjpg-streamer which I installed before octoprint from here:

I had mjpg working on localhost:8080 but now when I type that in all I get is a 404 error page not found. I have mjpg-streamer running on boot and port 8080 is still being used.

I used the reverse proxy file from here:

is this suppose to be /etc/nginx/nginx.conf ?

I get the octoprint UI at http://localhost

but http://localhost:8080 does not show me the mjpg-streamer anymore, how do I access the web page for mjpg-streamer?

What did you already try to solve it?
tried
http://localhost:8080
http://localhost/webcam/
http://localhost/mjpg-streamer/

all say no page can be found

Logs (octoprint.log, serial.log or output on terminal tab, browser error console ...)
terminal tab in octoprint shows no errors
control tab in octoprint shows the mjpg-streamer image that was also available on port 8080 or is that the point of reverse proxy, it does not allow the mjpg-streamer file to be seen on any other page?

SERIAL LOG:

2019-08-11 18:09:46,233 - serial.log is currently not enabled, you can enable it via Settings > Serial Connection > Log communication to serial.log
2019-08-11 18:36:30,493 - Enabling serial logging
2019-08-11 18:36:32,026 - Recv:  T:25.51 /0.00 B:25.65 /0.00 @:0 B@:0
2019-08-11 18:36:34,026 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:36:36,027 - Recv:  T:25.48 /0.00 B:25.77 /0.00 @:0 B@:0
2019-08-11 18:36:38,027 - Recv:  T:25.51 /0.00 B:25.68 /0.00 @:0 B@:0
2019-08-11 18:36:40,027 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:36:42,027 - Recv:  T:25.48 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:36:44,026 - Recv:  T:25.48 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:36:46,026 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:36:48,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:36:50,026 - Recv:  T:25.45 /0.00 B:25.54 /0.00 @:0 B@:0
2019-08-11 18:36:52,027 - Recv:  T:25.45 /0.00 B:25.60 /0.00 @:0 B@:0
2019-08-11 18:36:54,027 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:36:56,026 - Recv:  T:25.45 /0.00 B:25.65 /0.00 @:0 B@:0
2019-08-11 18:36:58,027 - Recv:  T:25.45 /0.00 B:25.54 /0.00 @:0 B@:0
2019-08-11 18:37:00,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:02,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:04,026 - Recv:  T:25.45 /0.00 B:25.60 /0.00 @:0 B@:0
2019-08-11 18:37:06,026 - Recv:  T:25.45 /0.00 B:25.48 /0.00 @:0 B@:0
2019-08-11 18:37:08,027 - Recv:  T:25.45 /0.00 B:25.71 /0.00 @:0 B@:0
2019-08-11 18:37:10,027 - Recv:  T:25.45 /0.00 B:25.54 /0.00 @:0 B@:0
2019-08-11 18:37:12,026 - Recv:  T:25.45 /0.00 B:25.51 /0.00 @:0 B@:0
2019-08-11 18:37:14,026 - Recv:  T:25.45 /0.00 B:25.65 /0.00 @:0 B@:0
2019-08-11 18:37:16,026 - Recv:  T:25.45 /0.00 B:25.54 /0.00 @:0 B@:0
2019-08-11 18:37:18,026 - Recv:  T:25.45 /0.00 B:25.51 /0.00 @:0 B@:0
2019-08-11 18:37:20,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:22,025 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:24,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:26,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:28,026 - Recv:  T:25.45 /0.00 B:25.60 /0.00 @:0 B@:0
2019-08-11 18:37:30,026 - Recv:  T:25.43 /0.00 B:25.60 /0.00 @:0 B@:0
2019-08-11 18:37:32,026 - Recv:  T:25.43 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:37:34,025 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:37:36,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:38,025 - Recv:  T:25.45 /0.00 B:25.71 /0.00 @:0 B@:0
2019-08-11 18:37:40,027 - Recv:  T:25.45 /0.00 B:25.60 /0.00 @:0 B@:0
2019-08-11 18:37:42,027 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:37:44,026 - Recv:  T:25.43 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:37:46,025 - Recv:  T:25.45 /0.00 B:25.51 /0.00 @:0 B@:0
2019-08-11 18:37:48,026 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:37:50,025 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:37:52,025 - Recv:  T:25.45 /0.00 B:25.51 /0.00 @:0 B@:0
2019-08-11 18:37:54,026 - Recv:  T:25.45 /0.00 B:25.51 /0.00 @:0 B@:0
2019-08-11 18:37:56,026 - Recv:  T:25.45 /0.00 B:25.57 /0.00 @:0 B@:0
2019-08-11 18:37:58,026 - Recv:  T:25.45 /0.00 B:25.62 /0.00 @:0 B@:0
2019-08-11 18:38:00,026 - Recv:  T:25.43 /0.00 B:25.57 /0.00 @:0 B@:0

octoprint.log
octoprint.log (92.0 KB)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ...)

Octoprint version: OctoPrint : 1.3.11
Printer: Creality Ender 3 Pro
firmware on Creality Ender 3 : Marlin bugfix-2.0
browser: Chromium on raspberry pi 4B
operating system: Buster desktop
the raspberry pi 4B has 4GB of RAM and I am running Marlin bugfix-2.0 which handles both 32-bit boards and 8-bit boards. At the moment I am using creality board v1.1.4 but I will be installing SKR V1.3 board after I get a couple of good prints going. Right now I am in the process of trying to get ocotprint running with the printer

Any help would be appreciated, I know this is probably a stupid question but the one area I have little knowledge in is Web servers

Thanks for any help you can provide.

I found this :slight_smile:

and found out that if I do this:

http://localhost // I get the octoprint UI
http://localhost:8080/?action=stream // I get the mjpg-streamer

So problem solved

the :8080 is connecting directly to the streamer bypassing your nginx
not sure if nginx can reverse-proxy/cache the stream. according to the note here:
https://forum.nginx.org/read.php?2,122149,122337#msg-122337
it can't but if you look here: https://nginx.org/en/docs/stream/ngx_stream_proxy_module.html there is this ngx_stream_proxy module that should be able to do exactly what you want. never tried but something like

load_module ngx_stream_proxy_module;

...

        location /camera {
                proxy_pass http://localhost:8080;
        }
...

and then you should see camera on http://localhost/camera?action=stream

here is my ngx_stream_proxy_module: (I call it 3d-printer.conf)
server {

webcam port, optional.

location /webcam {
proxy_pass http://localhost:8080;
}

location /octoprint/ {
proxy_pass http://localhost:5000/;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /octoprint;
proxy_http_version 1.1;
client_max_body_size 0;
}

}

when I go to http://localhost the octoprint UI shows up
when I go to http://localhost/webcam/?action=stream the mjpg-streamer shows up

Thanks for the help

Something I don't understand is that in your opening post you say you have installed the OctoPi image. That image comes with mjpg-streamer and HAProxy preconfigured. They should work out of the box.

oops, I installed Buster first, then I installed octoprint manually