First of all, I am already running a similar Python flask web server on the machine.
I am following this tutorial in order to host a web server with Python Flask.
And in the 5th step (No problem so far), when i test with :
systemctl status myproject
I get
serveurB.service - uWSGI instance to serve serveurB
Loaded: loaded (/etc/systemd/system/serveurB.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-06-28 14:25:45 UTC; 1min 53s ago
Process: 7992 ExecStart=/home/sydney/serveurB/serveurB/bin/uwsgi --ini serveurB.ini
(code=exited, status=1/FAILURE)
Main PID: 7992 (code=exited, status=1/FAILURE)
Jun 28 14:25:45 ecocathlon uwsgi[7992]: detected binary path: /home/sydney/serveurB/serveurB/bin/uwsgi
Jun 28 14:25:45 ecocathlon uwsgi[7992]: !!! no internal routing support, rebuild with pcre support !!!
Jun 28 14:25:45 ecocathlon uwsgi[7992]: your processes number limit is 3789
Jun 28 14:25:45 ecocathlon uwsgi[7992]: your memory page size is 4096 bytes
Jun 28 14:25:45 ecocathlon uwsgi[7992]: detected max file descriptor number: 1024
Jun 28 14:25:45 ecocathlon uwsgi[7992]: lock engine: pthread robust mutexes
Jun 28 14:25:45 ecocathlon uwsgi[7992]: thunder lock: disabled (you can enable it with --thunder-lock)
Jun 28 14:25:45 ecocathlon uwsgi[7992]: bind(): Permission denied [core/socket.c line 230]
Jun 28 14:25:45 ecocathlon systemd[1]: serveurB.service: Main process exited, code=exited, status=1/FAILURE
Jun 28 14:25:45 ecocathlon systemd[1]: serveurB.service: Failed with result 'exit-code'.
In which
myproject = serveurB
myprojectenv = serveurB (yes same name, i misstyped that one but i don't think it is the issue)
user = sydney
All my previous steps and files seem correct.
Thanks in advance,
Sydney R.
2
Answers
They key line in the error message is this one:
bind
is the method that will "bind" your socket to a port for listening and you are receiving a "Permission denied" error. That means you are using a low number port (< 1024) and are not root.I would recommend changing the port to something higher than 1024 since running an app as root can be dangerous. There are other solutions as well but they are out of scope for this answer.
You have to be careful about the naming when setting up your project on digital ocean. The best way to make sure you not getting any naming error just make the project name consistent from the project and when setting up your server as well. For this I would suggest that you double check your nguni service file and see if you actually referenced your uWSGI project.