motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.94k stars 650 forks source link

DEV - Port 80 not working #2867

Open cavernerg opened 11 months ago

cavernerg commented 11 months ago

When I set "PORT = 80" in the motioneye.conf, the GUI is not reachable (after restart). Port 8765 is working fine.

zagrim commented 11 months ago

Maybe it's just inaccuracy when writing the description, but the correct format is in lowercase and no equals sign: port 80 Please take a look in the logs (sudo journalctl -u motioneye), you probably have an error there. Or if you are trying to reach the GUI from another box, there might be firewall rule blocking that port, or some port forwarding config that needs to reflect the port change.

cavernerg commented 11 months ago

The port isn't even in use, when I check it via netstat. (I just substitute the number so lower or upper cases aren't the thing ;-))

zagrim commented 11 months ago

Would you please provide the logs I mentioned above, I can't help if I'm not seeing what's happening there?

frank-que commented 10 months ago

Hello @zagrim, I have the same problem, with port 8765 everything works correctly, but not with port 80. I think it's a permissions problem... here is the log:

Nov 16 11:49:22 rpi5-motioneye systemd[1]: motioneye.service: Consumed 3.684s CPU time. Nov 16 11:49:22 rpi5-motioneye systemd[1]: motioneye.service: Failed with result 'exit-code'. Nov 16 11:49:21 rpi5-motioneye systemd[1]: motioneye.service: Main process exited, code=exited, status=1/FAILURE Nov 16 11:49:20 rpi5-motioneye meyectl[926]: AttributeError: 'NoneType' object has no attribute 'dumps' Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/lib/python3.11/multiprocessing/queues.py", line 371, in put Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/lib/python3.11/multiprocessing/pool.py", line 271, in del Nov 16 11:49:20 rpi5-motioneye meyectl[926]: Traceback (most recent call last): Nov 16 11:49:20 rpi5-motioneye meyectl[926]: Exception ignored in: <function Pool.del at 0xffffb084db20> Nov 16 11:49:20 rpi5-motioneye meyectl[926]: PermissionError: [Errno 13] Permission denied Nov 16 11:49:20 rpi5-motioneye meyectl[926]: sock.bind(sockaddr) Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/lib/python3.11/dist-packages/tornado/netutil.py", line 162, in bind_sockets Nov 16 11:49:20 rpi5-motioneye meyectl[926]: ^^^^^^^^^^^^^ Nov 16 11:49:20 rpi5-motioneye meyectl[926]: sockets = bind_sockets( Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/lib/python3.11/dist-packages/tornado/tcpserver.py", line 183, in listen Nov 16 11:49:20 rpi5-motioneye meyectl[926]: server.listen( Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/lib/python3.11/dist-packages/tornado/web.py", line 2207, in listen Nov 16 11:49:20 rpi5-motioneye meyectl[926]: application.listen(settings.PORT, settings.LISTEN) Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/lib/python3.11/dist-packages/motioneye/server.py", line 463, in run Nov 16 11:49:20 rpi5-motioneye meyectl[926]: run() Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/lib/python3.11/dist-packages/motioneye/server.py", line 504, in main Nov 16 11:49:20 rpi5-motioneye meyectl[926]: server.main(arg_parser, sys.argv[2:], command[:-6]) Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/lib/python3.11/dist-packages/motioneye/meyectl.py", line 337, in main Nov 16 11:49:20 rpi5-motioneye meyectl[926]: ^^^^^^ Nov 16 11:49:20 rpi5-motioneye meyectl[926]: sys.exit(main()) Nov 16 11:49:20 rpi5-motioneye meyectl[926]: File "/usr/local/bin/meyectl", line 8, in Nov 16 11:49:20 rpi5-motioneye meyectl[926]: Traceback (most recent call last): Nov 16 11:49:20 rpi5-motioneye meyectl[926]: INFO: mjpg customer garbage collector has started Nov 16 11:49:20 rpi5-motioneye meyectl[926]: INFO: tasks started Nov 16 11:49:20 rpi5-motioneye meyectl[926]: INFO: wsswitch started Nov 16 11:49:20 rpi5-motioneye meyectl[926]: INFO: cleanup started

frank-que commented 10 months ago

The problem come because port under 1024 are privileged (you need root permission to use)

I've bypassed the problem in this way:

install nginx: "sudo apt-get install nginx"

Remove or comment out any existing server section from file "/etc/nginx/sites-available/default" and add this:

server { listen 80; servername ;

location / {
    proxy_pass http://127.0.0.1:8765/;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Prefix /;
}

}

I hope this can help someone.

zagrim commented 10 months ago

@frank-que yes, something like that was one of the things I was suspecting.