Can´t open deployed admin panel

System Information
  • Strapi Version: 3.3.4
  • Operating System: ubuntu server 18.04
  • Database: MongoDB
  • Node Version: v12.18.1
  • NPM Version: 6.14.5
  • Yarn Version:

I’m installing the strapi api in Digitalocean and I can’t seem to deploy the admin panel. The API is deployed sucessfully but the GUI says in terminal - info :hourglass_flowing_sand: Opening the admin panel… and returns always 404 when acessing /admin url. The api is retrieved succefully.

I’m using the same configuration of Strapi’s documentation | Strapi Documentation for NGINX and server configuration is:

module.exports = ({ env }) => ({
host: env(“HOST”, “127.0.0.1”),
port: env.int(“PORT”, 1337),
admin: {
autoOpen: false
},
});

Make sure you have built the admin:

  • yarn build --clean
  • npm run build -- --clean

Only the develop command will build the admin, and only when the build folder doesn’t exist, for staging/production (using the start command) you need to build the admin yourself, and rebuild it should any of the Strapi package versions change.

I have build the admin and still not working. Im running the command NODE_ENV=production npm run start for the test before adding to pm2.
My server config file is under config/env/production and keeps triyng to open the admin panel.

My nginx file:

server {
listen 443 ssl;
listen [::]:443 ssl;

server_name             example.pt www.example.pt;
root                    /var/www/example.pt/html;
index index.html index.htm index.nginx-debian.html;
# SSL
ssl_certificate         /etc/ssl/example.pem;
ssl_certificate_key     /etc/ssl/example.key;
# security
include                 nginxconfig.io/security.conf;

# reverse proxy
location / {
    proxy_pass http://127.0.0.1:3000;
    include    nginxconfig.io/proxy.conf;
    add_header Access-Control-Allow-Origin "https://example.pt";
    add_header Referrer-Policy "origin-when-cross-origin" always;
    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
}  }

server {
listen 443 ssl;
listen [::]:443 ssl;
server_name api.example.pt;
# SSL
ssl_certificate /etc/ssl/example.pem;
ssl_certificate_key /etc/ssl/example.key;
location / {
proxy_pass http://strapi;

    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;
} }

Can you provide your ./config/env/production/server.js file here (also for builds you do need to use NODE_ENV=production yarn build for example)

Also can you give a directory listing for your Strapi project folder with ls -al /path/to/your/strapi/project/root After you build.

It’s the one I have in the question

module.exports = ({ env }) => ({
host: env(“HOST”, “0.0.0.0”),
port: env.int(“PORT”, 1337),
admin: {
autoopen: false,
},
});

I’ve also added the nginx file

The build exists, but your Nginx config looks a little odd. Did you follow one of our guides to set this up? IE: https://strapi.io/documentation/v3.x/deployment/nginx-proxy.html

Yes, sorry i’ve copied the complete file. The first server is my frontend app allocated in example.pt. The second is the strapi api allocated in the subdomain api.example.pt.

apparently after changing the default configuration to the same configurations as production and messing with the npm run build, did the trick

1 Like

Just change the port, it should work