I had a node.js app with nginx running totally fine on a domain i purchased. It was run on an ubuntu server and all was well. I accidentally clicked "create image" on the aws site and ever since then the site doesn't work. The local ip address through port 3000 is working as expected, but the domain is not. It is loading the first html file but cannot GET the stylesheets or javascripts that go with it and none of the css or javascript files are being loaded, rather they are all returning 404. I uninstalled/reinstalled nginx and such but have not had any luck. any ideas? I don't want to change any code or such if possible, as it was working TOTALLY as expected/desired before this. I would like to express again that literally nothing other than clicking one button on aws has caused this issue
here is a config file for nginx
#
server {
listen 80;
listen [::]:80;
server_name example.org www.example.org;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.org www.example.org;
location / {
proxy_pass http://localhost:3000/login.html;
}
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem; # managed by Certbot
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_session_cache shared:SSL:5m;
ssl_session_timeout 1h;
add_header Strict-Transport-Security “max-age=15768000” always;
}
#
also, here is what was working for my app.js this may be a good time to ask if i'm doing everything ok, im sure it can be improved as I am still just learning
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser')
var logger = require('morgan');
var User = require("./models/user");
var db = require('./db.js');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var devicesRouter = require('./routes/devices')
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.use(logger('dev'));
app.use(express.json());
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/devices', devicesRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
module.exports = app;