Created
January 11, 2017 12:27
-
-
Save w00lf/5770c5808eae4f110bfa05dd8d75a0af to your computer and use it in GitHub Desktop.
Revisions
-
w00lf revised this gist
Jan 11, 2017 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ version: '2' services: redis: image: redis nginx: build: . command: tail -f /var/log/nginx/access.log environment: - REDIS_URL=redis ports: - "3000:3000" depends_on: - redis -
w00lf created this gist
Jan 11, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ FROM centos:latest MAINTAINER Mikl Taraskin <[email protected]> ADD nginx-build-rpm /tmp/nginx-build-rpm WORKDIR /tmp/nginx-build-rpm RUN rpm -Uvh nginx-build.rpm RUN yum install -y redis RUN mkdir -p /etc/nginx/include.d/rewrites/ ADD example.rb /etc/nginx/include.d/rewrites/example.rb ADD nginx.conf /etc/nginx/nginx.conf This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ client = Redis.new('redis', 6379, 2) # Connect to the server ENV['REDIS_URL'] client.select 0 r = Nginx::Request.new Nginx.errlogger Nginx::LOG_ERR, "request uri: #{r.uri}" if matched_redirect = client.get(r.uri) matched_redirect else r.uri end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # Work around problem 'no "events" section in configuration' events { } http { server { listen 3000; location / { mruby_set $redirect_candidate "/etc/nginx/include.d/rewrites/example.rb"; if ($redirect_candidate != $request_uri) { rewrite ^(.*)$ $redirect_candidate permanent; } return 200 "hello world"; } } }