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.

By brenda
I have everything set up with my sudoer account on my Ubuntu VPS, e.g. /ghost directory and sub content owned by sudoer account. I’ve added my domain to the ocean domain DNS and can ping my domain and get back my server’s IP, so this is working fine. I had configured Ghost first, so I am able to get to my site via the IP:2368 and domain:2368 fine, but I wanted to use the nginx proxy server, so I could access it via port 80. Therefore, I setup nginx, I started the service, and when I got to my site (e.g. site.com), I get “502 Bad Gateway”. When looking at the errors logs, I see the following:
2014/05/17 16:40:40 [error] 29645#0: *21 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XXX.XXX.XXX, server: site.com request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:2368/”, host: “site.com”
I can see nginx is running:
sudo service nginx status
The nginx config file contains the usual:
server { listen 0.0.0.0:80; server_name my-domain-name; access_log /var/log/nginx/my-domain-name.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header HOST $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:2368;
proxy_redirect off;
}
}
My sudoer account is a member of www-data, so my /ghost folder is owned by the sudoer and the www-data group. Both have read, write and execute permissions to all the folders and files in /ghost only. Do I need to change permissions anywhere else for this to work? I’ve been reading other people’s problems with error 502 and they all seem to solve them by changing permissions on their /ghost directory, but I think they are using root and that is not my case.
Note: I get the same error if I log in a root, restart nginx, and load my page, or if I log in as sudoer, restart nginx, and load my page.