Change php version under var/www/html

Hello everyone, I would like to change the basic version of php for a folder under var/www/html/myfolder. I downloaded php collections but I can’t change php version (assuming you can do it on the html root. ) I tried a virtual host and it gives me the options of choice, but if I leave the virtual host being the connection managed by another neth server in reverse proxy I can not load the page of the virtual host, which is why I wanted to move the installation of a program under var/www/html/myprograms. But I’m not going on because of version 5.x

Using the virtualhosts module is the recommended way.
A name reverse proxy should work in this case.
Could you please share your virtualhost and reverse proxy settings?

You could create a custom httpd conf file /etc/httpd/conf.d/custom.conf with following content:

<Directory /var/www/html/myprograms>
    AddType application/x-httpd-php .php
    <FilesMatch \.php$>
         SetHandler "proxy:fcgi://127.0.0.1:9003"
    </FilesMatch>
    AllowOverride All
    Require all granted
</Directory>

This way PHP7.3 is used for /var/www/html/myprograms.
nethserver-rh-php73-php-fpm needs to be installed.

7 Likes

Thank you, as soon as possible I will try to do as you indicated.

1 Like

Hi Markuz, I tried and it works. I only modified the owner or apache:apache under var/www/html because the program could not write. In addition, from the custom file you provided me, I added other programs and it looks like the same directives or rather. Here is the result.

At the moment I’m going ahead to see if everything is ok. Thank you as always.

Using the virtualhosts module is the recommended way.
A name reverse proxy should work in this case.
Could you please share your virtualhost and reverse proxy settings?
[/quote]
Yes Markuz then I’ll explain:
I have a first nethserver server with reverse proxy activated, where it currently redirects http traffic to 3 servers, everything works well. When I tried to install a program and configure the virtual host on another nethserver server eg. mysecondserver.local the application works very well locally as a virtual host, but if I try to configure the reverse proxy pointing to the virtual host

As you can see from the screen of the first nethserver server, the reverses are configured and work perfectly, if I add the name of a virtualhost and not its path, it does not work. I noticed that when creating a virtualhost the root path is not the standard one (clearly). Is it possible that this generates the impossibility of the connection?

You are using a path reverse proxy starting with a /
Please try a name reverse proxy like sub.domain.org.
This way reverse proxy should work.

Yes, in fact, if I use the syntax “/myfolderremoteserver”, it works. If instead the second server has an application like virtualhost e.g. mysitevirtualhost.local.lan and therefore from the first server that has reverse proxy I enter the fqdn as written above, it does not work, mid isce that the path does not exist. I checked if the name is fixed and it is resolved regularly. I don’t understand why!

If the path reverse proxy does not work, you may try name reverse proxy instead of using a path, for example:

grafik

Maybe you need to set the reverse proxies to redirect to https instead of http?

nethserver-php-scl did it in the past with netgui

In fact, I tried with myvhost.domain.org and indicated the path in the next box. But he tells me he doesn’t find anything.
In addition, only the initial mask of nethserver the base one appears, so the hostv is connected, but if I add the host.domain.org/myapp path it tells me that it does not find it.