简体   繁体   English

将数据从Nginx传递到Sinatra应用

[英]Pass data from Nginx to Sinatra app

So we do have our Jekyll app that serves a static webpage, which includes a contact form. 因此,我们确实拥有可提供静态网页(包括联系表格)的Jekyll应用程序。 This contact form request then gets passed (POST) to our Sinatra-app at http://sub.example.com/send_email to deliver an email to inform us about the new contact.. 然后,此联系表单请求将(POST)传递(POST)到我们的Sinatra应用程序, 网址http://sub.example.com/send_email,以发送电子邮件以通知我们有关新联系人的信息。

So far so good, everything works fine if we run the Sinatra-app by using 到目前为止,如果我们使用来运行Sinatra-app,一切都可以正常工作

bundle exec rackup config.ru

However, upon starting nginx and passenger_ruby, our Sinatra app does not receive any data whatsoever. 但是,启动nginx和passenger_ruby时,我们的Sinatra应用程序不会接收任何数据。

We have set up the server like this: 我们像这样设置服务器:

server {
    listen 80;
    server_name sub.example.com;
    error_log /home/example/error.log warn;
    access_log /home/example/access.log;

    passenger_enabled on;
    passenger_ruby /home/example/.rbenv/shims/ruby;
    root /home/example/evil_contact/public;
}

Now when accessing http://sub.example.com the access.log and error.log file do not have any entry. 现在,当访问http://sub.example.com ,access.log和error.log文件没有任何条目。 It is as if the request wouldn't arrive over at nginx or does not get passed through. 好像请求不会到达nginx或没有通过。

Let me know if there is something else needed. 让我知道是否还有其他需要。 Maybe we are just missing something obvious here. 也许我们只是在这里缺少明显的东西。

Thank you in advance. 先感谢您。

Alrighty, Alrighty,

After dozen of coffees the solution was not to change the nginx settings, but check the DNS records. 一杯咖啡后,解决方案不是更改nginx设置,而是检查DNS记录。

Afterall, the DNS entry had still a wrong IP assigned, so the request was going somewhere else. 毕竟,DNS条目仍分配了错误的IP,因此请求转到其他地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM