Skip to content

Instantly share code, notes, and snippets.

@simkimsia
Last active July 9, 2016 02:52
Show Gist options
  • Save simkimsia/7655342 to your computer and use it in GitHub Desktop.
Save simkimsia/7655342 to your computer and use it in GitHub Desktop.
restler api nginx config
server {
listen 80;
client_max_body_size 2M;
server_name ng-book.oppoin.com;
root /var/virtual/ng-book.oppoin.com/current/examples/http-api-server;
location / {
index index.html index.htm;
}
location /api {
index index.php;
if ( !-e $request_filename) {
rewrite ^.* /api/index.php last;
}
}
# Pass PHP scripts to PHP-FPM
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
@Arul-
Copy link

Arul- commented Nov 26, 2013

Try the following

server {
        listen 80;
        client_max_body_size 2M;
        server_name ng-book.localhost;
        root /var/virtual/WebApps/ng-book/examples/http-api-server;

        location / {
                index  index.html index.htm;
        }

        location /api {
                index index.php;
                if ( !-e $request_filename) {
                        rewrite ^.* /api/index.php last;
                }
        }
        # Pass PHP scripts to PHP-FPM
    location ~* \.php$ {
        fastcgi_index   index.php;
        fastcgi_pass    127.0.0.1:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment