I have a nodejs backend hosted on AWS EC2 Ubuntu 20.04 instances.
When i ssh into my server, everything is working accordingly. Today i tried configuring nginx, so i created website.com files inside sites-available .
website.com
server {
listen 80;
listen [::]:80;
root /home/ubuntu/apps/yelp-app/client/build;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name api.website.com www.api.website.com;
location / {
try_files $uri /index.html;
}
location /api {
proxy_pass http://localhost:3001;
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;
}
}
After saving that file, i ran the following command:
sudo ln -s /etc/nginx/sites-available/website.com /etc/nginx/sites-enabled/
From the docs, in order to enable the new site i need to restart nginx using the following:
systemctl restart nginx
Unfortunately, it keeps asking for the ubuntu user password which i did not ever set.
Can someone help me out?