There is UNIT software in DirectAdmin, that makes it possible. Instructions on how to install it can be found by the link:
- https://docs.directadmin.com/webservices/nginx_unit/
The UNIT interface in DirectAdmin allows to create applications based on NodeJs, Python, Ruby, Java, Perl (it is not about software development though). It is about managing them in Web-UI of DirectAdmin. And then it allows to configure a webserver to route requests to the applications.
Thus, if a user has a Node-JS application, they would need:
1. upload an application to /home/USER/domains/DOMAIN/appdir
2. install dependences and requirements using npm
3. add the application in DirectAdmin UNIT using CREATE function
4. add a route for a domain
5. wait for a changes to apply
This is the simple set of steps can be seen on the same link posted above.
I tested it on CentOS 7, AlmaLinux 8 and 9 with apache+nginx, litespeed, openlitespeed and apache.
Found issues:
1. CentOS7, AlmaLinux 9: failed dependences and conflicts with Java, Python, whenever multiple versions of libraries are installed.
2. LiteSpeed: routing fails to identify a valid host when requests proxied to http://127.0.0.1:8090/ (work fine with an external IP) - FIXED
3. "Unit" should be allowed for users in their preferences and hosting packages. Disable/enable it for changes to take an effect.
4. Other minor issues with installation of Unit
Should you have issues with Unit in DirectAdmin interface, one might need to run:
In certain cases the UNIT is missing "listeners" after an installation:
They should be shown in the reply, for example:
The listener "*:8091" is missing by default, and it is fine.
More posts about UNIT can be found here: https://help.poralix.com/tags/nginx-unit
~~~~ UPDATED 2024.05.20 ~~~~
The issue with proxying routes in LiteSpeed is fixed as of the DirectAdmin version v.1.663 e3952a646cfd0f8aeacda4a1e54e2c66a61a22a4. Another way to proxy requests is used there for LiteSpeed, for example:
Check it here https://docs.directadmin.com/change...eed-unit-use-proxypass-instead-of-rewriterule
- https://docs.directadmin.com/webservices/nginx_unit/
The UNIT interface in DirectAdmin allows to create applications based on NodeJs, Python, Ruby, Java, Perl (it is not about software development though). It is about managing them in Web-UI of DirectAdmin. And then it allows to configure a webserver to route requests to the applications.
Thus, if a user has a Node-JS application, they would need:
1. upload an application to /home/USER/domains/DOMAIN/appdir
2. install dependences and requirements using npm
3. add the application in DirectAdmin UNIT using CREATE function
4. add a route for a domain
5. wait for a changes to apply
This is the simple set of steps can be seen on the same link posted above.
I tested it on CentOS 7, AlmaLinux 8 and 9 with apache+nginx, litespeed, openlitespeed and apache.
Found issues:
1. CentOS7, AlmaLinux 9: failed dependences and conflicts with Java, Python, whenever multiple versions of libraries are installed.
2. LiteSpeed: routing fails to identify a valid host when requests proxied to http://127.0.0.1:8090/ (work fine with an external IP) - FIXED
3. "Unit" should be allowed for users in their preferences and hosting packages. Disable/enable it for changes to take an effect.
4. Other minor issues with installation of Unit
Should you have issues with Unit in DirectAdmin interface, one might need to run:
Bash:
/usr/local/directadmin/custombuild/build rewrite_confs
In certain cases the UNIT is missing "listeners" after an installation:
Bash:
# /usr/bin/curl -s -X GET --unix-socket /var/run/unit/control.sock http://localhost/config/
{
"listeners": {},
"routes": [],
"applications": {}
}
They should be shown in the reply, for example:
Bash:
[root@dev ~]# /usr/bin/curl -s -X GET --unix-socket /var/run/unit/control.sock http://localhost/config/
{
"listeners": {
"*:8090": {
"pass": "routes/$host"
},
"*:8091": {
"pass": "routes/$host",
"tls": {
"certificate": "hostname"
}
}
},
"routes": {},
"applications": {}
}
[root@dev ~]#
The listener "*:8091" is missing by default, and it is fine.
More posts about UNIT can be found here: https://help.poralix.com/tags/nginx-unit
~~~~ UPDATED 2024.05.20 ~~~~
The issue with proxying routes in LiteSpeed is fixed as of the DirectAdmin version v.1.663 e3952a646cfd0f8aeacda4a1e54e2c66a61a22a4. Another way to proxy requests is used there for LiteSpeed, for example:
Code:
<Location "/rubyapp">
ProxyPreserveHost On
RequestHeader set Host "devXXXX.poralix.net"
ProxyPass "http://127.0.0.1:8090/rubyapp"
ProxyPassReverse "http://127.0.0.1:8090/rubyapp"
</Location>
Check it here https://docs.directadmin.com/change...eed-unit-use-proxypass-instead-of-rewriterule
It was found that the RewriteRule in LiteSpeed was not passing the Host header, thus Unit was not able to pass the request to the correct route. Testing of various LiteSpeed versions confirmed that the ProxyPass is required to properly have LiteSpeed pass the Host header to Unit.
Last edited: