Hi, I kinda managed to solve the issue. This is my config in case it will help anyone (the “location / { … }” made Strapi work for me). However, I’m not sure if I should uncomment the “try_files …” line.
server {
root /var/www/api.eduardstefan.com/html;
index index.html index.htm index.nginx-debian.html;
server_name api.eduardstefan.com www.api.eduardstefan.com;
location / {
proxy_pass http://localhost:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# try_files $uri $uri/ =404;
}
listen [::]:443 ssl http2 ipv6only=on; # managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/api.eduardstefan.com/fullchain.pem; # m>
ssl_certificate_key /etc/letsencrypt/live/api.eduardstefan.com/privkey.pem; #>
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.api.eduardstefan.com) {
return 301 https://api.eduardstefan.com$request_uri;
} # managed by Certbot
if ($host = api.eduardstefan.com) {
return 301 https://api.eduardstefan.com$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name api.eduardstefan.com www.api.eduardstefan.com;
return 404; # managed by Certbot
}