I deployed my first website on AWS EC2(MERN Stack) and it work fine as long as I access it from / path. So if you access this link, it works alright: http://3.124.204.215/ and you can access any other page from here. But if you try to access this path directly: http://3.124.204.215/signin, it returns 404. I can curl localhost:8080/signin, so I assume that the problem is from nginx.
Is there any property for this problem?
THE NGINX CONFIGURATION:
server {
listen 80;
listen [::]:80;
listen 443;
listen [::]:443;
root /var/www/amazon-clone/deploy/build;
location / {
try_files $uri $uri/ =404;
proxy_pass http://172.31.40.72:8080;
proxy_redirect http://172.31.40.72:8080/ /;
}
location /api/ {
proxy_redirect off;
proxy_pass_header Server;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 5;
proxy_read_timeout 240;
proxy_intercept_errors on;
proxy_pass http://172.31.40.72:5000;
}
}
Aucun commentaire:
Enregistrer un commentaire