Hello all. Good day to you. So I have been trying to deploy a Nodejs app which is accessible when I run <serverIP>:3000 but not with 'example.com'. As I have always been deploying NodeJS apps in Ubuntu based servers with Nginx as reverse proxy, I'm having a hard time figuring out how to make it work in DirectAdmin with CentOS 7 server and Apache as reverse proxy.
The app is located in '/home/username/myNodeApp' and I have already added the VirtualHosts in '/usr/local/directadmin/data/users/username/httpd.conf' file and this is how it looks like:
Right now when I visit the domain, I can see the contents of an html page which is located in '/var/www/html' and this file is mentioned in '/etc/httpd/conf/httpd.conf' as 'DocumentRoot /var/www/html'. Seems like Apache is not even recognizes my config file.
Can anyone tell me what I'm doing wrong here? I have been struggling for the last 1 week and finally found this forum and I feel like I'm at the right place.
The app is located in '/home/username/myNodeApp' and I have already added the VirtualHosts in '/usr/local/directadmin/data/users/username/httpd.conf' file and this is how it looks like:
Apache config:
# Auto generated apache config file by DirectAdmin version 1.641
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to their website
# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=2
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3
<Directory "/home/<username>/public_html">
<IfModule mod_fcgid.c>
SuexecUserGroup <username> <username>
</IfModule>
php_admin_flag engine ON
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'
php_admin_value mail.log /home/<username>/.php/php-mail.log
php_admin_value open_basedir /home/<username>/:/tmp:/var/tmp:/opt/alt/php74/usr/share/pear/:/dev/urandom:/usr/local/lib/php/:/usr/local/$
</Directory>
<VirtualHost example.com:80>
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</VirtualHost>
<VirtualHost *:443>
Header always set Strict-Transport-Security "max-age=31536000"
ServerName example.com
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$"no-gzip
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
ExpiresActive On
ProxyRequests off
RequestHeader add original-protocol-ssl 1
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://serverIp:3000/
ProxyPassReverse http://serverIp:3000/
ProxyPreserveHost On
</Location>
</VirtualHost>
Right now when I visit the domain, I can see the contents of an html page which is located in '/var/www/html' and this file is mentioned in '/etc/httpd/conf/httpd.conf' as 'DocumentRoot /var/www/html'. Seems like Apache is not even recognizes my config file.
Can anyone tell me what I'm doing wrong here? I have been struggling for the last 1 week and finally found this forum and I feel like I'm at the right place.