I have a monorepo apps in my Cloudways server and I thought I could configure through nginx sites-enabled, but turns out they configure things through .htaccess file.
Apparently I have never touched any .htaccess file before so I'm pretty confused on how to configure it for monorepo.
Current configuration (default from Cloudways)
DirectoryIndex disabled
RewriteEngine On
RewriteRule ^(.*)$ http://localhost:3000/$1 [P,L]
RewriteRule ^$ http://localhost:3000/ [P,L]
Nginx proxy sample
server {
listen 80;
listen [::]:80;
root /home/ubuntu/apps/my-app;
index index.html index.htm index.nginx-debian.html;
server_name domain.com sub.domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
My plan is to start 2 apps in 2 different ports using pm2 and I will proxy them by server_name like nginx do but I don't know how.