【发布时间】:2020-11-02 08:55:44
【问题描述】:
我已经在 EC2 免费轮胎上部署了我的第一个 React、Node、MongoDB、Nginx 应用程序。后端 API 单独工作,前端也运行良好。但前端 API 调用无法相互访问。
前端:http://18.130.30.219/ 节点API:http://18.130.30.219:5000/api/article/thumbist
default.conf 如下
server {
#listen 80;
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
access_log /home/ubuntu/client/server_logs/host.access.log main;
location / {
root /home/ubuntu/client/deploy;
index index.html index.htm;
try_files $uri /index.html;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
server_tokens off;
location ~ /\.ht {
deny all;
}
}
【问题讨论】:
-
你介意分享你的 Dockerfile 吗?
标签: node.js reactjs mongodb nginx amazon-ec2