Re: Apache httpd with Node.js backend server.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> Date: Monday, July 03, 2023 22:22:04 +0530
> From: Kaushal Shriyan <kaushalshriyan@xxxxxxxxx>
>
> On Mon, Jul 3, 2023 at 10:10 PM Richard wrote:
> 
>> 
>> > Date: Monday, July 03, 2023 20:35:36 +0530
>> > From: Kaushal Shriyan <kaushalshriyan@xxxxxxxxx>
>> > 
>> > I have initiated a new thread to discuss the new issue. I am
>> > running node.js application on port 8000 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
>> ># 
>> > 
>> > *#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/phpcode/cardium-version-1/web
>> >         DirectoryIndex index.php
>> > 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.php !
>> >         ProxyPassMatch "^/(.+)$" "http://localhost:8000/$1";
>> > 
>> > <Directory "/var/www/html/phpcode/cardium-version-1/web">
>> > DirectoryIndex index.html index.php
>> > Options FollowSymLinks
>> > AllowOverride All
>> >         Require valid-user
>> >         AuthType Basic
>> >         AuthName "Restricted Content"
>> >         AuthUserFile
>> > /var/www/html/phpcode/cardium-version-1/web/.htpasswd
>> > </Directory> </VirtualHost>
>> > 
>> > When I hit  https://phpnodejs.mydomain.com it works perfectly
>> > fine. But when I click on any of the links on the home page
>> > which adds /en at the end of all the links, I get Not Found on
>> > the browser for all the links.
>> > 
>> > For example https://https://phpnodejs.mydomain.com/en returns Not
>> > Found.                      https://
>> > https://phpnodejs.mydomain.com/en/community/webinars returns Not
>> > Found.
>> > https://phpnodejs.mydomain.com/en/community/articles returns Not
>> > Found.
>> > 
>> > When I hit https://phpnodejs.mydomain.com/nodejssl/server.js
>> > works perfectly fine as expected.
>> > 
>> > [image: image.png]
>> > 
>> > cat /var/log/httpd/ssl_access_log
>> > 172.16.16.45 - - [03/Jul/2023:20:09:27 +0530] "GET
>> > /en/community/webinars HTTP/1.1" 404 9
>> > 172.16.16.45 - - [03/Jul/2023:20:09:35 +0530] "GET
>> > /en/apis/use-cases HTTP/1.1" 404 9
>> > 172.16.16.45 - - [03/Jul/2023:20:09:45 +0530] "GET
>> > /en/support/contact-us HTTP/1.1" 404 9
>> > 172.16.16.45 - - [03/Jul/2023:20:10:02 +0530] "-" 408 -
>> > 172.16.16.45 - - [03/Jul/2023:20:09:12 +0530] "GET
>> > /__es-dev-server__/message-channel HTTP/1.1" 200 30
>> > 172.16.16.45 - drupaladmin [03/Jul/2023:20:11:00 +0530] "GET /
>> > HTTP/1.1" 200 45339
>> > 172.16.16.45 - - [03/Jul/2023:20:11:03 +0530] "GET
>> > /en/community/webinars HTTP/1.1" 404 9
>> > 172.16.16.45 - - [03/Jul/2023:20:11:09 +0530] "GET
>> > /en/apis/use-cases HTTP/1.1" 404 9
>> > 172.16.16.45 - - [03/Jul/2023:20:11:11 +0530] "GET /en HTTP/1.1"
>> > 404 9 172.16.16.45 - - [03/Jul/2023:20:11:29 +0530] "-" 408 -
>> > 
>> 
>> You need to make some efforts to debug things yourself. Start by
>> looking in the *appropriate* error_log file for the entries
>> *matching* the above access_log 404s. I suspect that that could
>> enlighten you.
>> 
>> 
>> 
>> ------------------------------------------------------------------
>> --- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For
>> additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>> 
>> 
> Thanks Richard for the hint and appreciate it. Using the below
> config file while commenting both ProxyPass and ProxyPassMatch
> directive it works perfectly fine.
> 
># ProxyPass /index.php !
># ProxyPassMatch "^/(.+)$" "http://localhost:8000/$1";
> 
   . . .
> 
> I will continue to debug and analyse the cause of the "Not Found"
> issue. Thanks in advance.
> 

Look at, and understand, the implications of the syntax of those
proxypass lines in the context of where your content is. The
documentation page referenced previously:

<https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch>

should help. Are the pages that you are getting 404s on on the proxy?



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux