Show More
@@ -1,73 +1,92 b'' | |||
|
1 | 1 | Nginx Configuration Example |
|
2 | 2 | --------------------------- |
|
3 | 3 | |
|
4 | 4 | Use the following example to configure Nginx as a your web server. |
|
5 | 5 | |
|
6 | 6 | .. code-block:: nginx |
|
7 | 7 | |
|
8 | 8 | upstream rc { |
|
9 | 9 | |
|
10 | 10 | server 127.0.0.1:10002; |
|
11 | 11 | |
|
12 | 12 | # add more instances for load balancing |
|
13 | 13 | # server 127.0.0.1:10003; |
|
14 | 14 | # server 127.0.0.1:10004; |
|
15 | 15 | } |
|
16 | 16 | |
|
17 | 17 | ## gist alias |
|
18 | 18 | |
|
19 | 19 | server { |
|
20 | 20 | listen 443; |
|
21 | 21 | server_name gist.myserver.com; |
|
22 | 22 | access_log /var/log/nginx/gist.access.log; |
|
23 | 23 | error_log /var/log/nginx/gist.error.log; |
|
24 | 24 | |
|
25 | 25 | ssl on; |
|
26 | 26 | ssl_certificate gist.rhodecode.myserver.com.crt; |
|
27 | 27 | ssl_certificate_key gist.rhodecode.myserver.com.key; |
|
28 | 28 | |
|
29 | 29 | ssl_session_timeout 5m; |
|
30 | 30 | |
|
31 | 31 | ssl_protocols SSLv3 TLSv1; |
|
32 | 32 | ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5; |
|
33 | 33 | ssl_prefer_server_ciphers on; |
|
34 | 34 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; |
|
35 | 35 | |
|
36 | 36 | # Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits |
|
37 | 37 | ssl_dhparam /etc/nginx/ssl/dhparam.pem; |
|
38 | 38 | |
|
39 | 39 | rewrite ^/(.+)$ https://rhodecode.myserver.com/_admin/gists/$1; |
|
40 | 40 | rewrite (.*) https://rhodecode.myserver.com/_admin/gists; |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | server { |
|
44 | 44 | listen 443; |
|
45 | 45 | server_name rhodecode.myserver.com; |
|
46 | 46 | access_log /var/log/nginx/rhodecode.access.log; |
|
47 | 47 | error_log /var/log/nginx/rhodecode.error.log; |
|
48 | 48 | |
|
49 | 49 | ssl on; |
|
50 | 50 | ssl_certificate rhodecode.myserver.com.crt; |
|
51 | 51 | ssl_certificate_key rhodecode.myserver.com.key; |
|
52 | 52 | |
|
53 | 53 | ssl_session_timeout 5m; |
|
54 | 54 | |
|
55 | 55 | ssl_protocols SSLv3 TLSv1; |
|
56 | 56 | ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5; |
|
57 | 57 | ssl_prefer_server_ciphers on; |
|
58 | 58 | |
|
59 | 59 | include /etc/nginx/proxy.conf; |
|
60 | 60 | |
|
61 | 61 | ## uncomment to serve static files by nginx |
|
62 | 62 | # location /_static { |
|
63 | 63 | # alias /path/to/.rccontrol/enterprise-1/static; |
|
64 | 64 | # } |
|
65 | 65 | |
|
66 | ## channel stream live components | |
|
67 | location /_channelstream { | |
|
68 | rewrite /_channelstream/(.*) /$1 break; | |
|
69 | proxy_connect_timeout 10; | |
|
70 | proxy_send_timeout 10m; | |
|
71 | proxy_read_timeout 10m; | |
|
72 | tcp_nodelay off; | |
|
73 | proxy_pass http://127.0.0.1:9800; | |
|
74 | proxy_set_header Host $host; | |
|
75 | proxy_set_header X-Real-IP $remote_addr; | |
|
76 | proxy_set_header X-Url-Scheme $scheme; | |
|
77 | proxy_set_header X-Forwarded-Proto $scheme; | |
|
78 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
|
79 | gzip off; | |
|
80 | proxy_http_version 1.1; | |
|
81 | proxy_set_header Upgrade $http_upgrade; | |
|
82 | proxy_set_header Connection "upgrade"; | |
|
83 | } | |
|
84 | ||
|
66 | 85 | location / { |
|
67 | 86 | try_files $uri @rhode; |
|
68 | 87 | } |
|
69 | 88 | |
|
70 | location @rhode { | |
|
71 | proxy_pass http://rc; | |
|
72 | } | |
|
89 | location @rhode { | |
|
90 | proxy_pass http://rc; | |
|
91 | } | |
|
73 | 92 | } |
General Comments 0
You need to be logged in to leave comments.
Login now