Re: [users@httpd] node.js application listening on port 8000 enabled with SSL certificate returns ERR_SSL_PROTOCOL_ERROR on browser.
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 ServerName phpnodejs.mydomain.com Redirect / https://phpnodejs.mydomain.com/ 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/ # 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 On Sat, Jul 1, 2023 at 2:08 AM Frank Gingras wrote: > To exclude index.html from your proxying, use ProxyPass /index.html ! > before the existing ProxyPass directive. > > On Fri, Jun 30, 2023 at 1:24 PM Kaushal Shriyan > wrote: > >> Hi, >> >> I have set up a new server with the below details. I am running node.js >> application on port 3000 and Apache HTTP server on CentOS Linux release >> 7.9.2009 (Core) >> >> # node --version >> *v16.20.0* >> # httpd -v >> Server version: *Apache/2.4.57 (IUS)* >> Server built: Apr 7 2023 14:49:47 >> # >> >> *Nodejs code document root -> /var/www/html/nodejssl (Node Port 3000)* >> # pwd >> /var/www/html/nodejssl >> # ls -l >> -rw-r--r-- 1 root root 336 Jun 27 09:43 server.js >> # >> *cat server.js* >> const http = require('http'); >> >> const hostname = '0.0.0.0'; >> const port = 3000; >> >> const server = http.createServer((req, res) => { >> res.statusCode = 200; >> res.setHeader('Content-Type', 'text/plain'); >> res.end('Hello World'); >> }); >> >> server.listen(port, hostname, () => { >> console.log(`Server running at http://${hostname}:${port}/`); >> }); >> >> >> *Website php code document root -> /var/www/html/phpcode (Port 443)* >> >> #pwd >> /var/www/html/phpcode/ >> # ls -l >> -rw-r--r-- 1 root root 336 Jun 27 09:43 index.html >> # >> #cat index.html >> >> >> >> >> >> Hello! >> >> >> >> Hello World! >> This is a simple paragraph. >> >> >> >> >> #cat /etc/httpd/conf.d/phpnodejs.conf >> >> ServerName phpnodejs.mydomain.com >> Redirect / https://phpnodejs.mydomain.com/ >> >> >> DocumentRoot /var/www/html/phpcode >> 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 / http://localhost:3000/ >> >> >> When i hit https://phpnodejs.mydomain.com/nodejssl/server.js I see >> "Hello World" which works as expected but when i hit >> https://phpnodejs.mydomain.com/ I do not see the html code index.html >> file content. Is there a way to render both index.html and node.js >> server.js file? For example when i hit https://phpnodejs.mydomain.com/ >> it renders index.html file content and when i hit >> https://phpnodejs.mydomain.com/nodej
Re: [users@httpd] node.js application listening on port 8000 enabled with SSL certificate returns ERR_SSL_PROTOCOL_ERROR on browser.
To exclude index.html from your proxying, use ProxyPass /index.html ! before the existing ProxyPass directive. On Fri, Jun 30, 2023 at 1:24 PM Kaushal Shriyan wrote: > Hi, > > I have set up a new server with the below details. I am running node.js > application on port 3000 and Apache HTTP server on CentOS Linux release > 7.9.2009 (Core) > > # node --version > *v16.20.0* > # httpd -v > Server version: *Apache/2.4.57 (IUS)* > Server built: Apr 7 2023 14:49:47 > # > > *Nodejs code document root -> /var/www/html/nodejssl (Node Port 3000)* > # pwd > /var/www/html/nodejssl > # ls -l > -rw-r--r-- 1 root root 336 Jun 27 09:43 server.js > # > *cat server.js* > const http = require('http'); > > const hostname = '0.0.0.0'; > const port = 3000; > > const server = http.createServer((req, res) => { > res.statusCode = 200; > res.setHeader('Content-Type', 'text/plain'); > res.end('Hello World'); > }); > > server.listen(port, hostname, () => { > console.log(`Server running at http://${hostname}:${port}/`); > }); > > > *Website php code document root -> /var/www/html/phpcode (Port 443)* > > #pwd > /var/www/html/phpcode/ > # ls -l > -rw-r--r-- 1 root root 336 Jun 27 09:43 index.html > # > #cat index.html > > > > > > Hello! > > > > Hello World! > This is a simple paragraph. > > > > > #cat /etc/httpd/conf.d/phpnodejs.conf > > ServerName phpnodejs.mydomain.com > Redirect / https://phpnodejs.mydomain.com/ > > > DocumentRoot /var/www/html/phpcode > 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 / http://localhost:3000/ > > > When i hit https://phpnodejs.mydomain.com/nodejssl/server.js I see "Hello > World" which works as expected but when i hit > https://phpnodejs.mydomain.com/ I do not see the html code index.html > file content. Is there a way to render both index.html and node.js > server.js file? For example when i hit https://phpnodejs.mydomain.com/ it > renders index.html file content and when i hit > https://phpnodejs.mydomain.com/nodejssl/server.js it renders node.js > server.js file content. > > Please suggest and guide me. Thanks in advance. > > Best Regards, > > Kaushal > > On Sun, Jun 25, 2023 at 10:13 PM Frank Gingras wrote: > >> None of those entries point to your 404 error. >> >> Make sure that you are reaching the proper vhost (with the scheme and >> hostname) by running apachectl -S. >> >> There is just far too much noise in the backlog of this thread to make >> sense of it so far. >> >> On Sun, Jun 25, 2023 at 11:46 AM Richard < >> lists-apa...@listmail.innovate.net> wrote: >> >>> >>> >>> >>> > Date: Sunday, June 25, 2023 16:09:23 +0530 >>> > From: Kaushal Shriyan >>> > >>> > I have modified the nodejsbackendssl.conf file located >>> > in /etc/httpd/conf.d/ to the below configuration. >>> > >>> > *#cat /etc/httpd/conf.d/nodejsbackendssl.conf* >>> > >>> > ServerName nodejs.mydomain.com >>> > ProxyPass / http://localhost:8000/ >>> > LogLevel debug >>> > ErrorLog /var/log/httpd/nodejssslerror.log >>> > CustomLog /var/log/httpd/nodejssslaccess.log combined >>> > >>> > >>> > Below are the logs in /var/log/httpd/nodejssslerror.log >>> > >>> > [Sun Jun 25 16:04:40.289171 2023] [proxy:debug] [pid 6223:tid 6223] >>> >> proxy_util.c(2155): AH00925: initializing worker >>> >> http://localhost:8000/ shared >>> >>> If you are still getting errors (e.g., 404s) on the front-end please >>> provide the relevant lines from the front-end server's error_log. The >>> proxy's corresponding log entries may be of value, but without the >>> detail from the front-end it's hard to tell. >>> >>> >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org >>> For additional commands, e-mail: users-h...@httpd.apache.org >>> >>>
Re: [users@httpd] node.js application listening on port 8000 enabled with SSL certificate returns ERR_SSL_PROTOCOL_ERROR on browser.
Hi, I have set up a new server with the below details. I am running node.js application on port 3000 and Apache HTTP server on CentOS Linux release 7.9.2009 (Core) # node --version *v16.20.0* # httpd -v Server version: *Apache/2.4.57 (IUS)* Server built: Apr 7 2023 14:49:47 # *Nodejs code document root -> /var/www/html/nodejssl (Node Port 3000)* # pwd /var/www/html/nodejssl # ls -l -rw-r--r-- 1 root root 336 Jun 27 09:43 server.js # *cat server.js* const http = require('http'); const hostname = '0.0.0.0'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); }); *Website php code document root -> /var/www/html/phpcode (Port 443)* #pwd /var/www/html/phpcode/ # ls -l -rw-r--r-- 1 root root 336 Jun 27 09:43 index.html # #cat index.html Hello! Hello World! This is a simple paragraph. #cat /etc/httpd/conf.d/phpnodejs.conf ServerName phpnodejs.mydomain.com Redirect / https://phpnodejs.mydomain.com/ DocumentRoot /var/www/html/phpcode 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 / http://localhost:3000/ When i hit https://phpnodejs.mydomain.com/nodejssl/server.js I see "Hello World" which works as expected but when i hit https://phpnodejs.mydomain.com/ I do not see the html code index.html file content. Is there a way to render both index.html and node.js server.js file? For example when i hit https://phpnodejs.mydomain.com/ it renders index.html file content and when i hit https://phpnodejs.mydomain.com/nodejssl/server.js it renders node.js server.js file content. Please suggest and guide me. Thanks in advance. Best Regards, Kaushal On Sun, Jun 25, 2023 at 10:13 PM Frank Gingras wrote: > None of those entries point to your 404 error. > > Make sure that you are reaching the proper vhost (with the scheme and > hostname) by running apachectl -S. > > There is just far too much noise in the backlog of this thread to make > sense of it so far. > > On Sun, Jun 25, 2023 at 11:46 AM Richard < > lists-apa...@listmail.innovate.net> wrote: > >> >> >> >> > Date: Sunday, June 25, 2023 16:09:23 +0530 >> > From: Kaushal Shriyan >> > >> > I have modified the nodejsbackendssl.conf file located >> > in /etc/httpd/conf.d/ to the below configuration. >> > >> > *#cat /etc/httpd/conf.d/nodejsbackendssl.conf* >> > >> > ServerName nodejs.mydomain.com >> > ProxyPass / http://localhost:8000/ >> > LogLevel debug >> > ErrorLog /var/log/httpd/nodejssslerror.log >> > CustomLog /var/log/httpd/nodejssslaccess.log combined >> > >> > >> > Below are the logs in /var/log/httpd/nodejssslerror.log >> > >> > [Sun Jun 25 16:04:40.289171 2023] [proxy:debug] [pid 6223:tid 6223] >> >> proxy_util.c(2155): AH00925: initializing worker >> >> http://localhost:8000/ shared >> >> If you are still getting errors (e.g., 404s) on the front-end please >> provide the relevant lines from the front-end server's error_log. The >> proxy's corresponding log entries may be of value, but without the >> detail from the front-end it's hard to tell. >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org >> For additional commands, e-mail: users-h...@httpd.apache.org >> >>
[users@httpd] RE: config - how are multiple VirtualHost directives for the same address handled?
> > > > How does apache httpd 2.4 handle multiple VirtualHost directives for > > the same address ? > > > > For example: > > > > > > SSLCertificateFile "${SRVROOT}/conf/server.crt" > ># ... > > > > > > > > DocumentRoot "/www/docs/host.example.com" > > # ... > > > > > > Are the settings merged, as if written like this: > > > > > > SSLCertificateFile "${SRVROOT}/conf/server.crt" > ># ... > > DocumentRoot "/www/docs/host.example.com" > > # ... > > > > But you are using ServerName and ServerAlias to load the correct one > not? > > There is no correct one. Both are correct. I want both. I don't understand the problem you are trying to solve. FWIIW from my past experience having identical virtual host configurations, apache services the one it first/last loads and ignores the rest. You just have to test this, but I would not want to use such a thing in production.
Re: [users@httpd] config - how are multiple VirtualHost directives for the same address handled?
On Fri, Jun 30, 2023 at 5:49 AM David Balazic wrote: > > Hi! > > How does apache httpd 2.4 handle multiple VirtualHost directives for the same > address ? There is no virtual host merging. It should be a simple test. - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
[users@httpd] RE: config - how are multiple VirtualHost directives for the same address handled?
From: Marc Sent: Friday, 30 June 2023 13:00 > > How does apache httpd 2.4 handle multiple VirtualHost directives for > the same address ? > > For example: > > > SSLCertificateFile "${SRVROOT}/conf/server.crt" ># ... > > > > DocumentRoot "/www/docs/host.example.com" > # ... > > > Are the settings merged, as if written like this: > > > SSLCertificateFile "${SRVROOT}/conf/server.crt" ># ... > DocumentRoot "/www/docs/host.example.com" > # ... > But you are using ServerName and ServerAlias to load the correct one not? There is no correct one. Both are correct. I want both. Regards, David The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. - To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org For additional commands, e-mail: users-h...@httpd.apache.org
[users@httpd] RE: config - how are multiple VirtualHost directives for the same address handled?
> > How does apache httpd 2.4 handle multiple VirtualHost directives for the > same address ? > > For example: > > > SSLCertificateFile "${SRVROOT}/conf/server.crt" ># ... > > > > DocumentRoot "/www/docs/host.example.com" > # ... > > > Are the settings merged, as if written like this: > > > SSLCertificateFile "${SRVROOT}/conf/server.crt" ># ... > DocumentRoot "/www/docs/host.example.com" > # ... > But you are using ServerName and ServerAlias to load the correct one not? > > Or is one directive block used and the other ignored (which one)? > > The reason I ask is that I have general SSL related settings in one file > ( ssl.conf ) and the content related settings in another ( content.conf > ) and both config files are included in the main config file. > You can have general ssl stuff in different (global) config. There is already such file and just add these to the Virtualhost SSLEngine on SSLCertificateFile SSLCertificateKeyFile SSLCertificateChainFile
[users@httpd] config - how are multiple VirtualHost directives for the same address handled?
Hi! How does apache httpd 2.4 handle multiple VirtualHost directives for the same address ? For example: SSLCertificateFile "${SRVROOT}/conf/server.crt" # ... DocumentRoot "/www/docs/host.example.com" # ... Are the settings merged, as if written like this: SSLCertificateFile "${SRVROOT}/conf/server.crt" # ... DocumentRoot "/www/docs/host.example.com" # ... ? Or is one directive block used and the other ignored (which one)? The reason I ask is that I have general SSL related settings in one file ( ssl.conf ) and the content related settings in another ( content.conf ) and both config files are included in the main config file. Lep pozdrav, David Balažic The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the Endava Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava plc is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava plc is the Endava group holding company and does not provide any services to clients. Each of Endava plc and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions.