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’ve been trying to deploy my web app the past few days, and while I can reach my site, when I try to navigate to an express route activated by a login button it gives me ‘localhost refused to connect’. My pages are served on localhost:3000, and my passport authentication and mongodb requests are made on port 4000.
Here is my /etc/nginx/sites-available/default
server {
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name <my_url> www.<my_url>;
location ^~ /assets/ {
gzip_static on;
expires 12h;
add_header Cache-Control public;
}
location / {
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:3000;
}
location /Notes {
proxy_pass http://localhost:4000;
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;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/<my_url>/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/<my_url>/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = <my_url>) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name <my_url> www.<my_url>;
return 404; # managed by Certbot
}
My routes are defined below, I’ve only included a few for brevity.
let PORT = 4000;
mongoose.connect('mongodb://localhost:27017/Notes', { dbName: "notes", useNewUrlParser: true>
const connection = mongoose.connection;
app.route('/Notes/auth/google').get( async (req, res, next) => {
passport.authenticate('google', {scope: ['profile']})(req, res, next);
});
app.use(cors({credentials: true, origin: 'http://localhost:3000'}));
app.use("/",noteRoutes);
app.use('/Notes/loggedin', async (req, res) => {
res.send(req.user);
});
app.listen(PORT, function(){
console.log(`Server is running on port ${PORT}`);
//console.log(app._router.stack);
});
My setup works great on localhost running on my own machine, but after deployment I cannot for the life of me get the redirect working. I am fairly certan I have the passport authentication setup correctly with the google API configured.
I’ve tried a few different configurations of the /etc/nginx/sites-available/default file, and haven’t had any luck, though I’m not sure I am understanding it properly. Port 4000 has been allowed with ufw.
Any help/suggestions would be extermely helpful, thank you!!
009fd274aeae48f2bfbda6ef568676
Cloudstream Apk
032f50ee7f7d489db3b05e204fe139
032f50ee7f7d489db3b05e204fe139
Edward Sitarski
ebeecroft
dashan
34bcef38725b4e6eb5224ae028f17e
markatango
gouskova