Hello, I have strapi one-click app and I want to make it https. What I do is :
- How To Secure Nginx with Let's Encrypt on Ubuntu 20.04 | DigitalOcean
- replace name_server with my subdomain at “/etc/nginx/sites-available/strapi.conf”
- replace URL with my subdomain at “/srv/strapi/strapi-development/config/server.js”
but it cause this
“http://vtmstrapi.tobimaungetes.host/vtmstrapi.tobimaungetes.host/admin”(look at the url)
(should be vtmstrapi.tobimaungetes.host/admin) and I try to open vtmstrapi.tobimaungetes.host/admin and this is what happened
Can you guys help me?
@tobiasjayas
Can you share the nginx config and ./config/server.js files. Have you Please make sure to delete private things from configs before sharing them. As it seems that you misconfigured them.
@sunnyson
here is my server.js file
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: "my subdomain",
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
},
});
/etc/nginx/sites-available/strapi.conf file
server {
# Listen HTTP
listen 80;
server_name my subdomain;
# Proxy Config
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;
}
}
@tobiasjayas
Seems ok,
Just a few questions to be sure,
Is it defined with ‘http://’ part: ‘http://strapi.example.com’ (It should include it)
Is the server_name defined as ‘strapi.example.com’ ? Without the http:// part? (it should be without it)
Have you rebuilt the Admin UI after changing the URL in server.js?
It Works! Thankyou @sunnyson