Permalink
Browse files

Remove upstream definition from nginx site config

  • Loading branch information...
sandrokeil committed Feb 22, 2017
1 parent 86a0ae6 commit 72ce8abe732785b4063cec610aeaf5e0b26fed00
Showing with 11 additions and 17 deletions.
  1. +11 −17 gateway/sites-enabled/www.conf
@@ -1,17 +1,8 @@
upstream php-todo-GET {
server php-todo-read:9000;
}

upstream php-todo-POST {
server php-todo-write:9000;
}

upstream php-user-GET {
server php-user-read:9000;
}

upstream php-user-POST {
server php-user-write:9000;
map $request_method $service_type {
default 'read';
POST write;
PUT write;
DELETE write;
}

server {
@@ -24,23 +15,26 @@ server {

include conf.d/basic.conf;

# this is the internal Docker DNS
resolver 127.0.0.11;

location = /api/v1/todo/ {
include config/php-location.conf;

fastcgi_pass php-todo-$request_method;
fastcgi_pass php-todo-$service_type:9000;
}
# POST request goes to php-user-POST and registers a new user
# GET request goes to php-user-GET and lists all registered users
location = /api/v1/user {
include config/php-location.conf;

fastcgi_pass php-user-$request_method;
fastcgi_pass php-user-$service_type:9000;
}
# GET request goes to php-user-GET and returns a single user
location ~ ^/api/v1/user/(?<userid>[A-Za-z0-9-]+)$ {
include config/php-location.conf;

fastcgi_pass php-user-$request_method;
fastcgi_pass php-user-$service_type:9000;
fastcgi_param USER_ID $userid;
}

0 comments on commit 72ce8ab

Please sign in to comment.