简体   繁体   English

nginx.conf用于restful api

[英]nginx.conf for a restful api

I'm currently developing a RESTful api as a bridge between my ios/web application and their shared database, and content. 我目前正在开发一个RESTful api,作为我的ios / web应用程序与其共享数据库和内容之间的桥梁。

I found my way to implement RESTful api in PHP on this blog . 我找到了在这个博客上用PHP实现RESTful api的方法。

I started my development on my OVH Apache-based server. 我在基于Apache的OVH服务器上开始开发。 Unfortunately, they didn't provide oauth support on web hosting services and there is no way to install it. 不幸的是,他们没有提供网站托管服务的oauth支持,也没有办法安装它。 OVH told me I needed a dedicated server or a VPS server for this. OVH告诉我,我需要一台专用服务器或一台VPS服务器。

Now, I'm going to work on dotCloud . 现在,我要开始使用dotCloud It's a great alternative, I think, but their servers (seemingly Amazon EC2's ones), are nginx-based. 我认为这是一个很好的选择,但他们的服务器(看似亚马逊EC2的服务器)是基于nginx的。 This would be the first time I've used a nginx server and I need your help for "translating" this .htaccess to a nginx.conf file. 这将是我第一次使用nginx服务器,我需要你的帮助将这个.htaccess “翻译”到nginx.conf文件中。

Before asking for your help, I tried to find a nginx.conf file for this but no one worked. 在寻求帮助之前,我试图为此找到一个nginx.conf文件,但没有人工作。 When I pushed them to my dotcloud app, the http service of my app crashed and dotcloud cli said : 当我把它们推到我的dotcloud应用程序时,我的应用程序的http服务崩溃了,dotcloud cli说:

14:55:44 [www.0] WARNING: The service crashed at startup or is listening to the wrong port. 14:55:44 [www.0]警告:服务在启动时崩溃或正在侦听错误的端口。 It failed to respond on port "http" (80) within 30 seconds. 它无法在30秒内响应端口“http”(80)。 Please check the application logs. 请检查应用程序日志。

Thanks for any help in advance :) 在此先感谢您的任何帮助:)

Thanks to this htaccess to nginx.conf converter, and some tricks and tests I've made, here is the corresponding nginx.conf file. 感谢这个 htaccess到nginx.conf转换器,以及我所做的一些技巧和测试, 这里是相应的nginx.conf文件。

I hope it will help people. 我希望它能帮到人们。 ;) ;)

EDIT: link to my configuration is dead, but the converter is still available. 编辑:链接到我的配置已经死了,但转换器仍然可用。 As long as you have a valid Apache configuration you're good to go. 只要你有一个有效的Apache配置,你就可以了。

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

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