I have an Ubuntu 18.04 with HestiaCP 1.1.1, and I’m trying to serve some Django apps.
In VestaCP it is more or less tricky to do, but it’s something that is possible to be done using mod_wsgi. However I’m having difficulties to make it work in HestiaCP.
Does anyone have any idea of why this could be failing? I can’t manage to see the Apache2 templates, to start with. All the steps are indicated in the README.md file.
I think being able to run Django and Flask apps will be a real asset for HestiaCP.
with the change to multi-php / php-fpm for apache and no prefork anymore in the newest hestia version you need to add your templates into /usr/local/hestia/data/templates/apache2/php-fpm to have them selectable. the folder level above only contains the old templates for compatibility reason with systems that don’t use multiphp.
maybe look at the new default template and compare to the old wsgi/django stuff, to see what’s obvious to be changed already…
interesting topic and nice to see someone developing stuff like this. keep us updated, while I don’t have a use case for django/flask, I am happy to help with the development. if you encounter further errors, please be as descriptive about it as possible, logentries or journaltctl messages often help a lot to narrow down on the issues best of luck!
The new templates can be chosen now, and the .sh script should do everything all right. However, it gives an “Error, apache2 restart failed” once the installation is completed. So I guess there’s something wrong with the tpl and stpl files.
If someone want to give it a try, you can check my progress at the testing branch . At the moment, only the Django template should do something, hence ignore the Flask template for now.
I have been checking the logs at /var/log/apache2/ and /var/log/apache2/domains, but I can’t see anything that can point me in the right direction. If any of you have more experience than me with the templates, please feel free to give it a try.
systemctl status apache2.service and journalctl -xe can be used for debugging
How ever when I try it on a test sever. I got this:
root@test:/usr/local/hestia# apachectl -t
AH00526: Syntax error on line 22 of /etc/apache2/conf.d/domains/test.nl.conf:
Name duplicates previous WSGI daemon definition.
Action ‘-t’ failed.
The Apache error log may have more information.
this usually is the most helpful for me, simply try to restart apache2 manually and run that command after the restart fails, the error message most likely points you into the right direction.
apachectl -t seems to show the same info as well, so now someone simply has to look at line 22 of the mentioned config file and figure what exactly is the duplicate there, right?
as said earlier the templates will need some adjustment to work with the newer configs used in hestia for apache anyway I am confident you’ll manage that…
afaik it uses the %domain%-django-ssl to have different names for the service per domain already and exactly avoid that duplicate error. so maybe it doesn’t fill in that placeholder correctly? what does the vhost conf-file say after it is actually created from the templates?
could it also be, that it even isn’t the vhost file you are looking at, but you already have some WSGI definitions in the general files somewhere or load a custom config you forgot about, that accidentically contains the same line and name? (just guessing around)
yes that seems wrong, as the name for the process, which is the 2nd part ‘admin-django’ in your example has to be different for each vhost. if you run multiple vhost and they have the same name there you’ll see that ‘duplicate’ message.
from the template this should be put together from the web-domain plus the -django… part, hence
%domain%-django-ssl
or
%domain%-django
depending on the template… in your example it seem to more likely use %user%-django instead - maybe you can check your .tpl file again, if you just accidentically put the wrong var in there?
having %domain% there makes much more sense, as exactly that would be the key differantiator and not the user name
and check the ouput… according to the error you should see a name for that procces at least twice and the files which contain these lines
maybe that helps to narrow it down. I have a feeling that you are quite close already…
Yeah, I tried that, but it was appearing only once…
I really have interest in making this work because I see PHP too limited… And definitely more insecure than Python. But I’m running out of ideas on how to fix this…
from the snippet of your tpl/stpl you posted first it seems to be in there… from the quote of the ready made config later it seems to be missing. maybe run the same find for the processgroup again and check if it’s there at all and differs for ssl vs non-ssl.
I know it’s grasping at straws though… I am simply also running out of ideas, but I strongly believe that the error message is usually very close to the real problem