I need help to install my express js api on apache2 with ssl enabled but I didn't succed
The apache server is on the same that the express js api
My express js app
const express = require('express')
const app = express()
const path = require('node:path');
const fs = require("fs");
const https = require('https')
const paths = path.join(__dirname, 'paths');
const pathsFiles = fs.readdirSync(paths).filter(file => file.endsWith('.js'));
const options = {
key: fs.readFileSync('./privatekey.pem'),
cert: fs.readFileSync('./certificate.pem'),
};
for (const file of pathsFiles) {
const filePath = path.join(paths, file);
const p = require(filePath);
app.get(p.path, (req,res)=> p.execute(req,res))
}
app.get("/image",(req,res)=> res.sendStatus(403))
const server = https.createServer(options,app).listen(3000, () => {
console.log("Serveur à l'écoute")
})
My apache config
iglee.fr.conf
<VirtualHost *:80>
ServerName iglee.fr
ServerAlias www.iglee.fr
DocumentRoot "/var/www/idea_website"
<Directory "/var/www/idea_website">
Options +FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.website.log
CustomLog /var/log/apache2/access.website.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =iglee.fr [OR]
RewriteCond %{SERVER_NAME} =www.iglee.fr
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
iglee.fr-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName iglee.fr
ServerAlias www.iglee.fr
DocumentRoot "/var/www/idea_website"
<Directory "/var/www/idea_website">
Options +FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.website.log
CustomLog /var/log/apache2/access.website.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/iglee.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/iglee.fr/privkey.pem
</VirtualHost>
</IfModule>
Can you help me please ? I'm really lost