我让React App带有Nginx和使用pm2运行的NodeJS Express Backend API。昨晚一切正常,但是今天当我访问该网站时,发送到API的每个请求都返回ERR_CONNECTION_TIMED_OUT。
当我尝试使用API Tester测试API时,一切正常。
我的nginx配置:
server {
root /var/www/[my_repo]/client/build;
index index.html index.htm;
server_name www.mydomain.com mydomain.com;
location / {
try_files $uri /index.html;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
我网站上的DevTools: enter image description here
API测试器(相同的URL): enter image description here
顺便说一句,为什么当它是GET请求时,在DevTools中为什么显示OPTIONS url ..? 谢谢!