Ubuntu

배포 중파일 오류 수정

const express = require('express');
const path = require('path');
const app = express();
var url = require('url');
const HTTPS = require('https');
const url = require('url');
require('dotenv').config();
//화면 별 router 연결, 라우터 호출해서 페이지를 불러오는데 사용함.
var mainRouter = require('./routes') //호출시 index.js 실행 (main.js : title 할당하고 main.html 열어줌)
const mainRouter = require('./routes') //호출시 index.js 실행 (main.js : title 할당하고 main.html 열어줌)
const domain = "www.culturegallery.ml"
const sslport = 23023;
//디폴트 포트 값 : 8000
app.set('port', process.env.PORT || 23023);
......@@ -28,11 +30,17 @@ app.get("/find", function (req, res) {
res.send(querystring.word);
});
app.get('/logout', function (req, res) {
res.send("Logout success");
});
try {
const option = {
ca: fs.readFileSync('/etc/letsencrypt/live/' + domain + '/fullchain.pem'),
key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/privkey.pem'), 'utf8').toString(),
cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/cert.pem'), 'utf8').toString(),
};
app.listen(app.get('port'), () => {
HTTPS.createServer(option, app).listen(sslport, () => {
console.log(`Server is running at ${app.get('port')}`);
});
});
} catch (error) {
console.log('[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.');
console.warn(error);
}
......
This diff is collapsed. Click to expand it.
......@@ -18,6 +18,7 @@
"dotenv": "^8.2.0",
"ejs": "^3.1.5",
"express": "^4.17.1",
"mysql": "^2.18.1"
"mysql": "^2.18.1",
"mysql2": "^2.2.5"
}
}
......
var mysql = require('mysql');
var database = mysql.createConnection({
host: process.env.HOST,
user: process.env.USER,
password: process.env.PASSWORD,
host: "culturegallery.cm2bwcuyukrm.us-east-1.rds.amazonaws.com",
user: "root",
password: "dldbwp1207",
port: 3306,
database: "showdata"
});
......
......@@ -3,10 +3,7 @@
<head>
<title>
<%= title%>
<script>
</script>
<script>title</script>
</title>
<link rel="stylesheet" href='/stylesheets/mapPage_style.css' type="text/css">
<link rel="shortcut icon" href="/images/favicon.ico">
......