1
When trying to access konic.com.br the site is loaded normally, but when I enter another route that in the case of konic.com.br/contact it returns 404
app js.:
const express = require("express");
const app = express();
app.use(express.static('html'));
app.get('/', (req, res) => {
res.sendFile(__dirname, 'html/index.html');
});
app.get('/contato', (req, res) => {
res.sendFile (__dirname, 'html/contato.html');
res.send("Deu certo");
});
app.listen(3002).on('listening', () => {
console.log("Servidor rodando na porta 3002!");
});
module.exports = app;
/etc/Nginx/sites-available/default
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
root /var/www/konic.com.br/html;
index index.html index.htm index.nginx-debian.html;
server_name konic.com.br www.konic.com.br;
ssl_certificate /etc/letsencrypt/live/konic.com.br/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/konic.com.br/privkey.pem;
location / {
proxy_pass http://konic.com.br:3002;
include /etc/nginx/mime.types;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
try_files $uri $uri/ =404;
}
}
server {
listen 80;
listen [::]:80;
server_name lucasmrpires.com.br www.lucasmrpires.com.br;
root /var/www/lucasmrpires.com.br/html;
index index.html;
location / {
proxy_pass http://localhost:3003;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
try_files $uri $uri/ =404;
}
}
server {
if ($host = konic.com.br) {
return 301 https://$host$request_uri;
}
listen 80 default_server;
listen [::]:80 default_server;
server_name konic.com.br www.konic.com.br;
return 404;
}