I am deploying a NestJS application using Docker and Apache, and I’m encountering an issue where I can only access the application using the server’s IP address, but not via the configured CNAME. Additionally, only the /test
route seems to be accessible, while other routes are not working.
Setup Details:
-
Apache version: 2.4.52 (Ubuntu)
-
Docker version: 27.1.1
-
NestJS: Running inside a Docker container on port
5061
-
SSL Certificate: Configured on Apache
docker file
FROM node:18.20.4
WORKDIR /app/usr/
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5061
ENV env="dev"
ENTRYPOINT ["bash", "./entrypoint.sh"]
Apache Configuration:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
ServerName jobguide-ms-qa.in-sciencelabs.com
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/isl.crt
SSLCertificateKeyFile /etc/ssl/private/isl.key
SSLCertificateChainFile /etc/ssl/certs/islchain.crt
<Location />
ProxyPass http://xx.xx.xx:5061/ connectiontimeout=90 timeout=80 nocanon
ProxyPassReverse http://xx.xx.xx:5061/
</Location>
</VirtualHost>
</IfModule>
<VirtualHost *:80>
ServerName jobguide-microservice-qa.in-sciencelabs.com
Redirect / https://jobguide-ms-qa.in-sciencelabs.com/
</VirtualHost>
Problem:
-
I can access the application using the server’s IP (e.g.,
https://xx.xx.xx.xx
), but not via the CNAMEhttps://jobguide-ms-qa.in-sciencelabs.com
. -
Only the
/test
route is accessible, while others return 404. -
Confirmed the SSL certificates are correctly configured.
-
Verified that the CNAME DNS records are correct.
-
Checked Apache error logs, but I am not seeing any relevant errors.
Suraj Mane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.