Установка API Express Js с Apache и SSLApache

Ответить
Гость
 Установка API Express Js с Apache и SSL

Сообщение Гость »


Мне нужна помощь в установке моего API Express JS на Apache2 с включенным SSL, но мне это не удалось
Сервер Apache находится на том же сервере, что и API Express JS
Мое приложение Express JS

Код: Выделить всё

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

Код: Выделить всё

ServerName iglee.fr
ServerAlias www.iglee.fr
DocumentRoot "/var/www/idea_website"

Options +FollowSymLinks
AllowOverride all
Require all granted

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]


iglee.fr-le-ssl.conf

Код: Выделить всё


ServerName iglee.fr
ServerAlias www.iglee.fr
DocumentRoot "/var/www/idea_website"

Options +FollowSymLinks
AllowOverride all
Require all granted

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



Can you help me please ?
I'm really lost


Источник: https://stackoverflow.com/questions/781 ... he-and-ssl
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Apache»