Hey!
I deployed a Strapi backend, Vue frontend project on DigitalOcean via NGINX.
The project is “empty”, meaning it is the default boilerplate generated with the CLI.
The problem is with Strapi Admin login, i got an error after submitting.
error Error: secretOrPrivateKey must have a value
node_modules/strapi-admin/services/token.js:32:14
node_modules/strapi-admin/controllers/authentication.js:35:46
debug POST /admin/login (165 ms) 500
Browser console error: VM9:1 POST http:///api/admin/login 500 (Internal Server Error)
The Strapi version is 3.2.5, i did not migrate from previous versions whatsoever.
Here is my /etc/nginx/sites-available/default config
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
root /var/www/html/blog/client/dist;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
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;
}
location /dashboard {
proxy_pass http://strapi/dashboard;
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;
}
}
Upstream is configured to localhost.
And the Strapi server.js:
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: 'http://<dropletip>/api',
admin: {
url: '<dropletip>/dashboard',
secret: env('ADMIN_JWT_SECRET')
},
});
I did set up a .env file next to server.js and inside the root containing the generated ADMIN_JWT_SECRET, but is this enough? I mean, it’s not included in my requests.
System Information
- Strapi Version: 3.2.5
- Operating System: Ubuntu 20.04 (LTS) x64
- Database: none
- Node Version: v12.19.0
- NPM Version: 6.14.8
- Yarn Version: 1.22.5