Skip to content

Commit 4d4be25

Browse files
committed
change readme, fix nginx proxy websocket configuration
1 parent 2df4ae2 commit 4d4be25

File tree

4 files changed

+57
-18
lines changed

4 files changed

+57
-18
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
# To build:
55
#
66
# 1) Install docker (http://docker.io)
7-
# 2) Clone Nginx-Hipache repo if you haven't already: git clone
8-
# 3) Build: cd ...... && docker build .
7+
# 2) Clone nginx-lua-proxy repo if you haven't already:
8+
git clone https://github.com/Ermlab/nginx-lua-proxy.git
9+
# 3) Build: cd nginx-lua-proxy && docker build .
910
# 4) Run: docker run -d --name redis redis
10-
# 5) Run: docker run -d --link redis:redis -P <hipache_image_id>
11+
# 5) Run: docker run -d --link redis:redis -P nginx-lua-proxy
1112

1213
FROM ubuntu:14.04
1314
MAINTAINER Krzysztof Sopyła <[email protected]>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This procject is based on wonderfull projects:
3030
2. Run nginx-lua-proxy container and linked it with redis
3131
3232
```
33-
docker run -d --link redis:redis -p 9090:80 --name $CONTAINER_NAME $IMAGE
33+
docker run -d --link redis:redis -p 9090:80 --name $CONTAINER_NAME ermlab/nginx-lua-proxy
3434
```
3535
3636

nginx.conf

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ http {
2525

2626
#access_log logs/access.log main;
2727

28-
sendfile on;
28+
#we dont want to send a static files so we can commnet it (optimization)
29+
#sendfile on;
2930
#tcp_nopush on;
3031

32+
# don't buffer data-sends (disable Nagle algorithm). Good for sending frequent small bursts of data in real time.
33+
#tcp_nodelay on;
34+
3135
#keepalive_timeout 0;
3236
keepalive_timeout 65;
3337

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

42-
proxy_set_header Host $http_host;
43-
proxy_set_header X-Forwarded-Port $server_port;
44-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
45-
proxy_set_header X-Forwarded-Proto $scheme;
46-
proxy_set_header X-Forwarded-Protocol $scheme;
47-
proxy_set_header X-Real-IP $remote_addr;
46+
#proxy_set_header Host $http_host;
47+
#proxy_set_header X-Forwarded-Port $server_port;
48+
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49+
#proxy_set_header X-Forwarded-Proto $scheme;
50+
#proxy_set_header X-Forwarded-Protocol $scheme;
51+
#proxy_set_header X-Real-IP $remote_addr;
52+
53+
#proxy_read_timeout 30;
54+
#proxy_connect_timeout 10;
55+
56+
map $http_upgrade $connection_upgrade {
57+
default upgrade;
58+
'' close;
59+
}
4860

49-
proxy_read_timeout 30;
50-
proxy_connect_timeout 10;
5161

5262
server {
5363
listen 80;
5464
server_name localhost;
65+
client_max_body_size 20M;
66+
proxy_connect_timeout 7d;
67+
proxy_send_timeout 7d;
68+
proxy_read_timeout 7d;
69+
70+
#albo
71+
#websocket_connect_timeout ######;
72+
#websocket_send_timeout #####;
73+
#websocket_read_timeout #####;
74+
75+
76+
# location / {
77+
# resolver 127.0.0.1;
78+
# include nginx-lua.conf;
79+
# }
80+
81+
location / {
82+
83+
resolver 127.0.0.1;
84+
proxy_http_version 1.1;
85+
proxy_set_header X-Real-IP $remote_addr;
86+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
87+
proxy_set_header X-NginX-Proxy true;
88+
proxy_set_header Host $http_host;
89+
proxy_set_header Upgrade $http_upgrade;
90+
proxy_set_header Connection $connection_upgrade;
91+
proxy_redirect off;
92+
93+
include nginx-lua.conf;
94+
95+
}
96+
5597

56-
location / {
57-
resolver 127.0.0.1;
58-
include nginx-lua.conf;
59-
}
6098

6199
location /hellolua {
62100
content_by_lua '

run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
IMAGE=ermlab/nginx-lua
3+
IMAGE=ermlab/nginx-lua-proxy
44
TAG='latest'
55
CONTAINER_NAME=proxy-nginx-lua
66

0 commit comments

Comments
 (0)