On Sat, Jul 1, 2023 at 7:50 AM Kaushal Shriyan <kaushalshri...@gmail.com> wrote:
> Hi Frank, > > Thanks for the email response and much appreciated. I added the ProxyPass > /index.html ! directive in /etc/httpd/conf.d/phpnodejs.conf > > #cat /etc/httpd/conf.d/phpnodejs.conf > <VirtualHost *:80> > ServerName phpnodejs.mydomain.com > Redirect / https://phpnodejs.mydomain.com/ > </VirtualHost> > <VirtualHost *:443> > DocumentRoot /var/www/html/htmlcode > ServerName phpnodejs.mydomain.com > Header add Access-Control-Allow-Origin "*" > SSLEngine on > SSLCertificateFile /etc/letsencrypt/live/ > phpnodejs.mydomain.com/cert.pem > SSLCertificateKeyFile /etc/letsencrypt/live/ > phpnodejs.mydomain.com/privkey.pem > SSLCertificateChainFile /etc/letsencrypt/live/ > phpnodejs.mydomain.com/chain.pem > Header always set Strict-Transport-Security "max-age=63072000; > includeSubDomains" > ProxyPass /index.html ! > ProxyPass / http://localhost:3000/ > </VirtualHost> > > # apachectl configtest > Syntax OK > #apachectl -S > VirtualHost configuration: > *:80 phpnodejs.mydomain.com > (/etc/httpd/conf.d/phpnodejs.conf:1) > *:443 phpnodejs.mydomain.com > (/etc/httpd/conf.d/phpnodejs.conf:5) > ServerRoot: "/etc/httpd" > Main DocumentRoot: "/var/www/html" > Main ErrorLog: "/etc/httpd/logs/error_log" > Mutex mpm-accept: using_defaults > Mutex cache-socache: using_defaults > Mutex authdigest-opaque: using_defaults > Mutex watchdog-callback: using_defaults > Mutex proxy-balancer-shm: using_defaults > Mutex rewrite-map: using_defaults > Mutex ssl-stapling-refresh: using_defaults > Mutex authdigest-client: using_defaults > Mutex lua-ivm-shm: using_defaults > Mutex ssl-stapling: using_defaults > Mutex proxy: using_defaults > Mutex authn-socache: using_defaults > Mutex ssl-cache: using_defaults > Mutex default: dir="/run/httpd/" mechanism=default > PidFile: "/run/httpd/httpd.pid" > Define: DUMP_VHOSTS > Define: DUMP_RUN_CFG > User: name="apache" id=48 > Group: name="apache" id=48 > # > > when I hit https://phpnodejs.mydomain.com/ it still points to the nodejs > server.js file located in /var/www/html/nodejssl. For testing purposes, I > stopped the node js code to execute. I get the below message on the browser > which is expected behaviour. > > [image: image.png] > > I am still unable to render the index.html file from the document root > in /var/www/html/htmlcode which I created a new folder for testing > purposes. > > Please suggest and guide me. Thanks in advance. > > Best Regards, > > Kaushal > Hi, I have referred to https://httpd.apache.org/docs/2.4/mod/mod_dir.html by adding DirectoryIndex index.html directive in 443 virtualhost. The issue still persists. #cat /etc/httpd/conf.d/phpnodejs.conf <VirtualHost *:80> ServerName phpnodejs.mydomain.com Redirect / https://phpnodejs.mydomain.com/ </VirtualHost> <VirtualHost *:443> DocumentRoot /var/www/html/htmlcode DirectoryIndex index.html ServerName phpnodejs.mydomain.com Header add Access-Control-Allow-Origin "*" SSLEngine on SSLCertificateFile /etc/letsencrypt/live/ phpnodejs.mydomain.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/ phpnodejs.mydomain.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/ phpnodejs.mydomain.com/chain.pem Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains" ProxyPass /index.html ! ProxyPass / http://localhost:3000/ </VirtualHost> Please suggest further and guide me. Thanks in advance. Best Regards, Kaushal