Skip to content

Commit

Permalink
change readme, fix nginx proxy websocket configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ksopyla committed Dec 29, 2015
1 parent 2df4ae2 commit 4d4be25
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 18 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# To build:
#
# 1) Install docker (http://docker.io)
# 2) Clone Nginx-Hipache repo if you haven't already: git clone
# 3) Build: cd ...... && docker build .
# 2) Clone nginx-lua-proxy repo if you haven't already:
git clone https://github.com/Ermlab/nginx-lua-proxy.git
# 3) Build: cd nginx-lua-proxy && docker build .
# 4) Run: docker run -d --name redis redis
# 5) Run: docker run -d --link redis:redis -P <hipache_image_id>
# 5) Run: docker run -d --link redis:redis -P nginx-lua-proxy

FROM ubuntu:14.04
MAINTAINER Krzysztof Sopyła <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This procject is based on wonderfull projects:
2. Run nginx-lua-proxy container and linked it with redis
```
docker run -d --link redis:redis -p 9090:80 --name $CONTAINER_NAME $IMAGE
docker run -d --link redis:redis -p 9090:80 --name $CONTAINER_NAME ermlab/nginx-lua-proxy
```
Expand Down
64 changes: 51 additions & 13 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ http {

#access_log logs/access.log main;

sendfile on;
#we dont want to send a static files so we can commnet it (optimization)
#sendfile on;
#tcp_nopush on;

# don't buffer data-sends (disable Nagle algorithm). Good for sending frequent small bursts of data in real time.
#tcp_nodelay on;

#keepalive_timeout 0;
keepalive_timeout 65;

Expand All @@ -39,24 +43,58 @@ http {
# Required to announce the dead backends
lua_shared_dict deads 10m;

proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header Host $http_host;
#proxy_set_header X-Forwarded-Port $server_port;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_set_header X-Forwarded-Protocol $scheme;
#proxy_set_header X-Real-IP $remote_addr;

#proxy_read_timeout 30;
#proxy_connect_timeout 10;

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

proxy_read_timeout 30;
proxy_connect_timeout 10;

server {
listen 80;
server_name localhost;
client_max_body_size 20M;
proxy_connect_timeout 7d;
proxy_send_timeout 7d;
proxy_read_timeout 7d;

#albo
#websocket_connect_timeout ######;
#websocket_send_timeout #####;
#websocket_read_timeout #####;


# location / {
# resolver 127.0.0.1;
# include nginx-lua.conf;
# }

location / {

resolver 127.0.0.1;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;

include nginx-lua.conf;

}


location / {
resolver 127.0.0.1;
include nginx-lua.conf;
}

location /hellolua {
content_by_lua '
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

IMAGE=ermlab/nginx-lua
IMAGE=ermlab/nginx-lua-proxy
TAG='latest'
CONTAINER_NAME=proxy-nginx-lua

Expand Down

0 comments on commit 4d4be25

Please sign in to comment.