http://localhost:9000/admin/store/ net::ERR_CONNECTION_REFUSED

299 Views Asked by At

I try running React App (medusa.js).

medusa server is running on port 9000 medusa admin is running on port 7001 medusa storefront is running on port 8000

Now I add reverse proxy in nginx configuration:

server
{
    listen my_public_ip:80;
    server_name api.aray.pl www.api.aray.pl ;
    access_log /var/log/nginx/domains/api.aray.pl.log;
    access_log /var/log/nginx/domains/api.aray.pl.bytes bytes;
    error_log /var/log/nginx/domains/api.aray.pl.error.log;
    root /home/node/domains/api.aray.pl/public_html;
    index index.php index.html index.htm;
    include /usr/local/directadmin/data/users/node/nginx_php.conf;
    # Mail auto configuration (Thunderbird, MS Outlook)
    location ~ "^/\.well-known/autoconfig/mail/config-v1\.1\.xml$|^/([Aa]utodiscover)/\1\.xml$" {
        proxy_pass http://my_public_ip:9000;
        proxy_set_header X-Forwarded-For  $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
    }
    location /
    {
        # access_log off;
        proxy_buffering off;
        proxy_pass http://my_public_ip:7001;
    }
    location /nginx_static_files/
    {
        # access_log  /var/log/nginx/access_log_proxy;
        alias       /home/node/domains/api.aray.pl/public_html/;
        internal;
    }
    include /etc/nginx/webapps.conf;
}

Error: Storefront and admin panel working under domain but api not working because:

  GET http://localhost:9000/admin/store/ net::ERR_CONNECTION_REFUSED

This is for all endpoints.

Unfortunately, I don't know why the clutcher tries to get localhost instead of setting the endpoint to my domain name, e.g. http://api.aray.pl/admin/store/

0

There are 0 best solutions below