Having difficulties while deploying my project on Ubuntu server (probably nginx config or something)

New to everything, except markup and some js. Managed to create Strapi+Gatsby project on my local computer and everything was quite cool before I started to deploy it on Ubuntu server. At this moment i have both strapi and gatsby running on my server, but when i’m trying to go to Content type builder it stucks with everlasting preloader and errors and warnings in the console. 2 — ImgBB

This is how my ngnix config looks like right now

` location / {
proxy_set_header Host $http_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_set_header X-NginX-Proxy true;

            proxy_pass http://127.0.0.1:8000;
    }
    location /admin/ {
            proxy_set_header Host $http_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_set_header X-NginX-Proxy true;

            proxy_pass http://127.0.0.1:1337;
    }
    location /content-manager/ {
            proxy_set_header Host $http_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_set_header X-NginX-Proxy true;

            proxy_pass http://127.0.0.1:1337;
    }

`

I’m pretty sure that i have to add some more directives to it but can’t figure out what exactly i should add.

Thank you.

System Information
  • Strapi Version: 3.1.0-alpha.5
  • Operating System: 20.04
  • Node Version: 10.23.0
  • NPM Version: 6.14.8

@doc3030 Why are you proxy passing /admin/ and /content-manager/ ?

You should keep only the first location with root path /

    location / {
        proxy_pass http://127.0.0.1:1337;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $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_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_pass_request_headers on;
    }

Take a look at the documentation.
https://strapi.io/documentation/developer-docs/latest/deployment/nginx-proxy.html#nginx-proxying

location / {

} - but this one (root path) would be taken by gatsby’s http://127.0.0.1:8000

that is why I started to add different directives for Strapi.

Probably this should be done in a different way, right?

Oh, so you are mixing them on the same host name. In this case you should configure strapi to be in a sub-folder. Take a look a the documentation I’ve shared, there is an example on how todo this. But I would also recommend to configure strapi on a subdomain and not on subfolder, like: api.mysite.com

thank you, would try