Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I created a nodejs app on my Ubuntu server to run on socket.<mydomain>.com. The nodejs app is running successfully on pm2 and I have already configured the nginx file but when I go to socket.<mydomain>.com it keeps showing me the nginx welcome page.
I’ve been searching online for the past 2 days and I’ve tried a lot of things but it still doesn’t work.
What else do you thing I can do about this issue please?
nodejs - server.js
import express from "express";
import cors from "cors";
import server from "http";
import { Server } from "socket.io";
import pkg from "dotenv";
pkg.config();
const app = express();
const serve = server.createServer(app);
const io = new Server(serve, {
cors: {
origin: process.env.CLIENT_SERVER,
methods: ["GET", "POST"],
},
});
const port = process.env.PORT || 5000;
app.get("/", (req, res) => {
res.send("SOCKET SERVER!");
});
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
io.on("connection", (socket) => {
console.log("new socket connected");
socket.on("join-room", (roomId, userId, name, mic, cam, screen = false) => {
console.log(`new peer joined : ${name} `, userId);
socket.join(roomId);
socket.broadcast
.to(roomId)
.emit("user-connected", userId, name, mic, cam, screen);
socket.on("disconnect", () => {
console.log("disconnected", userId);
socket.broadcast.to(roomId).emit("user-disconnected", userId);
});
});
socket.on("toggle media", (userId, roomId, type) => {
console.log("toggle media for ", userId);
socket.broadcast.to(roomId).emit("user toggled media", userId, type);
});
});
// Server listen initilized
serve
.listen(port, () => {
console.log(`Listening on the port ${port}`);
})
.on("error", (e) => {
console.error(e);
});
nginx config - /etc/nginx/sites-available/socket.<mydomain>.com
server {
if ($host = socket.<mydomain>.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
}
server{
listen 443 ssl;
access_log /var/log/nginx/socket.<mydomain>.com.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:5000;
}
}
I also created a symbolic link at /etc/nginx/sites-enabled/socket.<mydomain>.com
/etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
When I run curl http://127.0.0.1:5000 and http://<myserverip>:5000 it shows the right output based on the nodejs app
After all of these, https://socket.<mydomain>.com still shows me the nginx welcome page on browser and with curl.
Please what do you think the problem is?
009fd274aeae48f2bfbda6ef568676
Cloudstream Apk
Ruz
Ruz
Edward Sitarski
ebeecroft
dashan
34bcef38725b4e6eb5224ae028f17e
markatango
gouskova
Andrew J Montanus