Custom HTTPD configuration in direct admin

arsenal23

New member
Joined
Jul 15, 2020
Messages
2
Hi,
I'm new to Directadmin, I'll appreciate if anyone can help me and save my time ?
I have a cloud server (Ubuntu 16 with DirectAdmin installed on it), and a domain (example.com), and a node.js app that running and listening on port 3000 (127.0.0.1:3000), What I want are:
1. if user type www.example.com in the browser then send him back index.html (static file)
2. if the user type www.example.com/api/test in the browser then send the request to my node.js app (127.0.0.1:3000/api/test) receive the response and send it to the user (reverse proxy).
Previously, when Direct Admin was not installed, I could do this through Nginx by this config:
Code:
server {
    listen 80;
    root /srv/www/web-app;
    
    location /api/ {
        proxy_pass http://127.0.0.1:3000;
    }
    
    location / {   
    }
}
But now I don't know what should I do in direct admin :(
 
You are supposed to add your custom config from admin panel > custom httpd configuration, but I tried that and it didn't work.
I directly edited /usr/local/directadmin/data/users/user/domains/domain.com.cust_nginx and that did it.
 
Back
Top