【发布时间】:2018-09-30 19:52:11
【问题描述】:
我在 ec2 实例 (ec2-13-229-218-180.ap-southeast-1.compute.amazonaws.com) 上运行节点快速服务器。它正在运行一个 Web 服务器来处理将与 RDS 数据库交互并返回查询的 http POST 请求。
我的目标是向端点发送 POST/GET 请求,例如(ec2-13-229-218-180.ap-southeast-1.compute.amazonaws.com/getData),并让 nginx 理解并翻译它到http://localhost:3000/getData 的 POST/GET 请求)
据我了解,我必须像这样设置 nginx 配置:
server {
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name ec2-13-229-218-180.ap-southeast-1.compute.amazonaws.com;
location / {
proxy_server http://localhost:3000;
//other stuff
}
}
Nginx 能够以当前配置运行,但是当我尝试测试向 ec2-13-229-218-180.ap-southeast-1.compute.amazonaws.com/getData 发送发布请求时,我得到404。谁能帮我这个?谢谢。
【问题讨论】:
标签: amazon-web-services express nginx amazon-ec2