System Information
- Strapi Version: 3.3.5
- Operating System: Debian 11
- Database: mysql
- Node Version: 14.0.0
- NPM Version: 6.14.4
- Yarn Version: 1.22.19
Hello everyone,
I’m getting a 504 Gateway Error on the script main.xxx.chunk.js when i’m running strapi behind Nginx with HTTPS enable, when i try to access the admin panel.
This page “https://subdomain.domain” is showing that strapi is running in production mode without error.
But when i try to go to the admin panel : “https://subdomain.domain/admin” i’m getting the 504 gateway timeout on one script .
This is my nginx conf :
server {
listen 80;
server_name subdomain.domain;
location / {
proxy_pass http://127.0.0.1:8084;
}
}
server {
server_name subdomain.domain;
location / {
proxy_pass http://127.0.0.1:8084;
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;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/subdomain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
access_log /var/log/nginx/subdomain/strapi-access.log combined_time;
error_log /var/log/nginx/subdomain/strapi-error.log;
}
My node is listening on 8084 port i’m using PM2 to run it, this is my pm2 config file :
module.exports = {
apps : [{
name : "strapi",
cwd : "./strapi/",
script : "yarn",
args : "start",
interpreter: '/bin/bash',
exp_backoff_restart_delay: 100,
env: {
"NODE_ENV" : "production",
"PORT" : 8084,
"DATABASE_HOST" : "127.0.0.1",
"DATABASE_PORT" : 3306,
"DATABASE_NAME" : "dbname",
"DATABASE_USERNAME" : "user",
"DATABASE_PASSWORD" : "pwd",
"STRAPI_LOG_LEVEL" : "info",
"ADMIN_JWT_SECRET" : "secret"
}
}]
And this is my strapi server.js conf :
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: "https://subdomain.domain/",
proxy: true,
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', 'secret'),
},
},
});
I’ve rebuild after setting up the url in server.js
If i disable https and remove the url in conf, it’s working well.
I’ve no clue how to solve this issue, if you guys have some idea i’ll be happy to read you
Thank’s you