What is the problem?
So I've got everything "working". http://prusa.local:5001/ goes to OctoPrint and http://prusa.local/camera/index.php goes to my camera. All very nifty. Even got OctoPrint to take imput from the camera just fine (though it sometimes has issues when I've not logged in to the camera page for a while - anyone know how to tell Ocotprint how to login to the camera page?) But currently just trying to get the reverse proxy running.
RPi_Cam_Web_Interface creates a /etc/nginx/sites-available/rpicam file and a redirect to it at /etc/nginx/sites-enabled/rpicam (would love to know how to create these myself) with the following contents:
server {
listen 80;
listen [::]:80;
root /var/www;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.html;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param REMOTE_USER $remote_user;
auth_basic "Off";
#auth_basic_user_file /usr/local/.htpasswd;
}
location ~ /\.ht {
deny all;
}
}
I've looked at a few reverse proxy examples, such as (from https://esmer-games.github.io/12-12-2018-octoprint-nginx-motion/);
server {
# webcam port, optional.
location /webcam {
proxy_pass http://localhost:8081;
}
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;
}
}
and (from https://community.octoprint.org/t/reverse-proxy-configuration-examples/1107)
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream "octoprint" {
server 127.0.0.1:5000;
}
upstream "mjpg-streamer" {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://octoprint/;
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_http_version 1.1;
client_max_body_size 0;
}
location /webcam/ {
proxy_pass http://mjpg-streamer/;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
but I'm not sure what to do to keep the functionality the original has, but add Octoprint to it.