This question is related to the question I asked here, but this is a more specific question, so I'm asking it separately.
I have an Angular Universal web app that I want to deploy on an Apache web server. I installed pm2 to start the app and keep it alive. It's listening on port 4000. It shows no errors in the logs, but I'm getting a 403 when I go to the website.
I think something in the .htaccess file is incorrect or something needs to be configured in the httpd.conf file. I'm confused as to what exactly needs to be in those files, because several links/articles I've read show different configurations. Some say you only need the .htaccess file. Other say you also need to configure a virtual host in the httpd.conf file (which I can't reach, because I don't have root privileges on the server).
This is how the folder structure looks like:
domains
- appname.com
- public_html
- .htaccess
- browser
- index.html
- other files...
- server
- server.js
- package.json
And this is my current .htaccess file, which should work for https and redirects to browser/index.html:
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/browser/index.html
I also tried this configuration which places a virtual host inside the .htaccess file, but that doesn't work.
To summarize my question: What exactly needs to be in the .htaccess file for Angular app to work? Is the virtual host tag supposed to by in the .htaccess as well or does that only work from the httpd.conf file?
Update
I contacted my web host. They said it's not possible to add the virtual host to the .htaccess file. So all I need is the redirect rewriteRule, taking https in consideration.