我创建了一个Rails API项目,它在本地工作。 (如果我浏览到localhost:3000/api/first
,则会在浏览器上打印true
。
我已按照此处的步骤进行操作 - https://gorails.com/deploy/ubuntu/14.04并已在我的EC2 Ubuntu服务器上部署了API。
如果我的IP地址是 - 1.2.3.4,如果我浏览到http://1.2.3.4/
,我会收到欢迎使用Nginx消息。但是,如果我浏览http://1.2.3.4/api/first
,我会收到404错误。
这是我的 / etc / nginx / sites-available / default
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name "";
passenger_enabled on;
rails_env production;
root /home/ubuntu/rails/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
如果我创建一个名为api
的文件夹(在/home/ubuntu/rails/current/public
中),并在其中创建一个名为first
的文本文件,则会显示该文件的内容。
答案 0 :(得分:0)
安装ngnix乘客模块并添加路径到ngnix conf文件。
代码应该是这样的:
delta = b*b-4*a*c
...
if delta > 0:
sqdelta = sqrt(delta)
x1 = (-b-sqdelta)/(2*a)
x2 = (-b+sqdelta)/(2*a)