There are a few tutorials on how to setup a Python + Flask app, with Nginx and gunicorn, but could not find any tutorial or documentation on how to do it when HestiaCP is installed.
I am running HestiaCP at an Ubuntu 22.04 LTS server (VPS).
If is relevant… At the time Hestia was installed, I tried to install without Apache and without PHP, but the installer always modified to include PHP. Then I selected Apache without PHP, and it installed Apache and some PHP by itself. Install command line was created with https://gabizz.github.io/hestiacp-scriptline-generator/
ok, HestiaCP is installed.
After all set, with the app running at port 5000, if I try to access mypythonapp using my IP and port (eg.: 188.33.55.1:5000) I can see it is running as expected.
My domain dev.mydomain.com is set at Cloudflare DNS and points to my Ubuntu VPS server. My domain been added to my Ubuntu server with HestiaCP.
Nginx /etc/nginx/sites-available/myapp is set as following:
server {
listen 443 ssl;
listen 80;
server_name dev.mydomain.com mydomain.com;
location / {
include proxy_params;
proxy_pass http://unix:/home/myusername/myapp/myapp.sock;
}
}
The problem is that… if I try to access myapp with dev.mydomain.com or mydomain.com it always open a default page saying:
We´re working on it!
This site is currently under construction.
Please check back soon.
That default page is located at /home/myusername/web/dev.mydomain.com/public_html and seems was created by Hestia.
How to access myapp by using dev.mydomain.com (at port 80 and 443)?
If I stop apache2 service with sudo systemctl stop apache2, then the “under construction” default page is replaced by an error page:
Internal Server Error
Oops! Something went wrong.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Error Code: 500
while acessing https://dev.mydomain.com with apache2 service stopped, at /var/log/apache2/domains/dev.mydomain.com.error.log I could see the Error 500 generate the following log: