8

I'm currently developing a RESTful api as a bridge between my ios/web application and their shared database, and content.

I found my way to implement RESTful api in PHP on this blog.

I started my development on my OVH Apache-based server. Unfortunately, they didn't provide oauth support on web hosting services and there is no way to install it. OVH told me I needed a dedicated server or a VPS server for this.

Now, I'm going to work on dotCloud. It's a great alternative, I think, but their servers (seemingly Amazon EC2's ones), are nginx-based. 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.

Before asking for your help, I tried to find a nginx.conf file for this but no one worked. When I pushed them to my dotcloud app, the http service of my app crashed and dotcloud cli said :

14:55:44 [www.0] WARNING: The service crashed at startup or is listening to the wrong port. It failed to respond on port "http" (80) within 30 seconds. Please check the application logs.

Thanks for any help in advance :)

Kazelin
  • 83
  • 8
abidon
  • 456
  • 4
  • 15
  • If I understand correctly, this .htaccess snippet will send all requests to non-existing files or directories to api.php, appending the original URI in the query string; whereas requests to existing files and directories will also be sent to api.php, but without appending the original URI in the query. Is that really what you need? – jpetazzo Jul 30 '12 at 08:14
  • Yes it was that but I found by myself how to do this with nginx. – abidon Jul 30 '12 at 22:12
  • Can you share how you did this? – pschang Mar 16 '13 at 00:05
  • @freshfunk: look down. there's a link to a htaccess to nginx.conf converter – abidon Mar 16 '13 at 06:35

1 Answers1

7

Thanks to this htaccess to nginx.conf converter, and some tricks and tests I've made, here is the corresponding nginx.conf file.

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.

abidon
  • 456
  • 4
  • 15