Page 1 of 1

Python support for Domains hosting

Posted: Sun 18. Jul 2021, 02:27
by gusarg81
Hi,

I am doing some testing with KeyHelp so I can finally migrate from i-MSCP hosting panel.
I use my server most of all to host my own Django projects, which for that I use WSGI.

Of course with i-MSCP I have to add all the needed configuration manually (in /etc/apache2/imsp/my.domain.conf) to able to support Python/WSGI./Django.

I believe (I could be wrong) that KeyHelp either supports domains settings for Python either out of the box. So, which would be the way to add Python/WSGI support in a particular domain?.

Thanks in advance.

Re: Python support for Domains hosting

Posted: Mon 19. Jul 2021, 11:52
by Florian
Hallo,

Pyton settings are not done by Keyhelp. You can add apache configuration advises for a domain under Domains -> Edit (pencil sign) -> tab Apache settings

Re: Python support for Domains hosting

Posted: Tue 20. Jul 2021, 15:07
by gusarg81
Florian wrote: ↑Mon 19. Jul 2021, 11:52 Hallo,

Pyton settings are not done by Keyhelp. You can add apache configuration advises for a domain under Domains -> Edit (pencil sign) -> tab Apache settings
Hi!

Thanks, I didn't saw that tab before asking (sorry). I will test there.

I assume I can add, for example, when I need to use Reverse Proxy settings for apache as well in there too, right?

Thanks in advance.

Re: Python support for Domains hosting

Posted: Tue 20. Jul 2021, 15:09
by gusarg81
Hi again,

By the way, I see that this option is missing on Subdomains. Is there any way to add custom settings for subdomains for apache?

Thanks.

Re: Python support for Domains hosting

Posted: Tue 20. Jul 2021, 16:03
by Tobi
gusarg81 wrote: ↑Tue 20. Jul 2021, 15:07 I assume I can add, for example, when I need to use Reverse Proxy settings for apache as well in there too, right?

Thanks in advance.
Yes 😉

Re: Python support for Domains hosting

Posted: Tue 20. Jul 2021, 16:04
by Tobi
gusarg81 wrote: ↑Tue 20. Jul 2021, 15:09 Hi again,

By the way, I see that this option is missing on Subdomains. Is there any way to add custom settings for subdomains for apache?

Thanks.
You can use a Sub-Domain as a Full-Domain.
Just enter „sub.domain.tld“ as domainname.

Re: Python support for Domains hosting

Posted: Tue 20. Jul 2021, 16:29
by Alexander
gusarg81 wrote: ↑Tue 20. Jul 2021, 15:09 By the way, I see that this option is missing on Subdomains. Is there any way to add custom settings for subdomains for apache?
The tab "Apache settings" is also there for subdomains.

I think your problem is the following: You are trying to modify the subdomains via the user area instead of the admin area.

You cannot change the apache settings within the user area, as this feature is only reserved for admin accounts (for server stability reasons).
Instead go to your admin area of your KeyHelp installation -> Go to "Domains" -> Click on "Customize view" and click the checkbox in front of "Subdomains". Now you will see the subdomains also in the admin area and can modify their Apache settings as you like.

Re: Python support for Domains hosting

Posted: Tue 20. Jul 2021, 16:43
by gusarg81
Alexander wrote: ↑Tue 20. Jul 2021, 16:29
gusarg81 wrote: ↑Tue 20. Jul 2021, 15:09 By the way, I see that this option is missing on Subdomains. Is there any way to add custom settings for subdomains for apache?
The tab "Apache settings" is also there for subdomains.

I think your problem is the following: You are trying to modify the subdomains via the user area instead of the admin area.

You cannot change the apache settings within the user area, as this feature is only reserved for admin accounts (for server stability reasons).
Instead go to your admin area of your KeyHelp installation -> Go to "Domains" -> Click on "Customize view" and click the checkbox in front of "Subdomains". Now you will see the subdomains also in the admin area and can modify their Apache settings as you like.
Ok! I saw the Customize View area, thats why I did not saw the subdomains list. Thanks! (I promise to read more the docs).

I am just trying to adapt to this new Hosting Panel.

Again, Thanks a lot!

Re: Python support for Domains hosting

Posted: Fri 23. Jul 2021, 22:01
by gusarg81
Hi again,

I am having problems with this, which I was not in i-IMSCP by using custom apache settings (the ones that being created in /etc/apache2/keyhelp/custom_vhosts).

I use custom apache settings so I can use my Django/Python websites. This was working in i-MSCP (it uses the same method, by including another conf file with Include directive) but here is giving me this error when I have more than 1 settings (and these settings is per subdomain, not all in one subdomain, so is weird).

Example setting:
Alias /media/ /home/users/gdnet/www/digikits/DIGIKits/digikits/media/
Alias /static/ /home/users/gdnet/www/digikits/DIGIKits/digikits/static/

<Directory /home/users/gdnet/www/digikits/DIGIKits/digikits/static>
Order deny,allow
Allow from all
Require all granted
</Directory>

<Directory /home/users/gdnet/www/digikits/DIGIKits/digikits/media/>
Order deny,allow
Allow from all
Require all granted
</Directory>

WSGIDaemonProcess gdnet_digikits python-home=/home/users/gdnet/www/digikits/venv python-path=/home/users/gdnet/www/digikits/DIGIKits socket-timeout=1800 user=gdnet group=www-data
WSGIProcessGroup gdnet_digikits
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /home/users/gdnet/www/digikits/DIGIKits/digikits/wsgi.py

<Directory /home/users/gdnet/www/digikits/DIGIKits/digikits/>
Order deny,allow
Allow from all
Require all granted
</Directory>
Now, in other 3 domains I have similar settings like this, but with different WSGIDaemonProcess and WSGIProcessGroup (and of course the paths of the site).

Any idea how to fix this? It is important since most site I run in this server are Django based.

Thanks in advance.

Re: Python support for Domains hosting  [SOLVED]

Posted: Sat 24. Jul 2021, 01:45
by gusarg81
Ok, I realize which is the problem. Is the twice Include of the custom_vhosts, which is the same for port 80 and port 443. So this is a problem.

I think this should be in separated file, for example, for VirtualHost with 80 port, domain_80.conf and for VirtualHost 443, domain_443.conf or something.

This is why WSGI is complaining.

Any idea how to workaround this? I know that is I modify the file, this will be replaced with any config update in the domain.

EDIT: I've fixed this by forcing SSL with "Enforce secure connection" and "HTTP Strict Transport Security (HSTS)".

Re: Python support for Domains hosting

Posted: Mon 26. Jul 2021, 15:24
by Alexander
Today I have implemented more control to the additional Apache directives feature. You can now define different directives for HTTP and HTTPS.
With the upcoming update, you won't need to work around this anymore, although picking "Enforce secure connection" is always a good choice.

Re: Python support for Domains hosting

Posted: Mon 26. Jul 2021, 16:04
by gusarg81
Hi,

Cool! Thanks.