Hello guys,
I'm writing here because I'm not able to run my react application in Https://
The react app was on the port 3000, so I used a nginx to "bind" it to the port 80.
Here is my configuration file :
upstream app_nodejs {
server 127.0.0.1:3000;
}
server {
#listen 80 is default
server_name app.yetic.org;
return 301 $scheme://mydomain.com$request_uri;
}
server {
listen 80;
listen [::]:80;
listen 443 default ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/app.yetic.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/app.yetic.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
server_name app.yetic.org;
if ($ssl_protocol = "") {
rewrite ^ https://$server_name$request_uri? permanent;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass https://app_nodejs;
proxy_redirect off;
}
}
It works with app.yetic.org:3000, but not with http://app.yetic.org (which redirects to https://app.yetic.org) and https://app.yetic.org doesn't work (no answer from the server).
I'm working on a VPS Ubuntu 22.04 (on Infomaniak)
I generated my certificates with the following command : sudo certbot --nginx -d app.yetic.org
Thanks in advance,
Jajoe