Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 8, 2013
1 parent edd97d2 commit 441d4e9
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 118 deletions.
60 changes: 5 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,67 +43,17 @@ cp conf/application.conf.dist conf/application.conf
`application.conf` extends `base.conf` and can override any value.
Note that `application.conf` is excluded from git index.

Language subdomains
-------------------
Websocket proxying and language subdomains
------------------------------------------

When accessed from the root domaing (e.g. lichess.org),
the application will redirect to a language specific subdomaing (e.g. en.lichess.org).
Additionally, lichess will open websockets on the `socket.` subdomain (e.g. socket.en.lichess.org).
Here is my local nginx configuration for `l.org`, assuming lila is installed in `/home/thib/lila` and runs on port 9000.

```conf
# Websockets
server {
listen 80;
server_name ~^socket\.\w\w\.l\.org$;
location / {
include lila-proxy.conf;
proxy_read_timeout 5s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http:https://127.0.0.1:9000/;
}
}
# Application
server {
listen 80;
server_name l.org ~^\w\w\.l\.org$;
location /assets {
alias /home/thib/lila/public;
}
location /serve {
alias /home/thib/lila/serve;
}
location /import {
proxy_set_header Host $http_host;
proxy_read_timeout 60s;
proxy_pass http:https://127.0.0.1:9000/import;
}
location / {
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
proxy_set_header Host $http_host;
proxy_read_timeout 90s;
proxy_pass http:https://127.0.0.1:9000/;
}
}
```

And the `/etc/hosts` file looks like:
Here is my local nginx configuration for `l.org`, assuming lila is installed in `/home/thib/lila` and runs on 127.0.0.1:9000
[/etc/nginx/l.org.conf](https://github.com/ornicar/lila/blob/master/doc/nginx/l.org.conf)

```
127.0.0.1 l.org
127.0.0.1 en.l.org
127.0.0.1 fr.l.org
127.0.0.1 socket.en.l.org
127.0.0.1 socket.fr.l.org
```
And here is my local [/etc/hosts file](https://github.com/ornicar/lila/blob/master/doc/hosts)

Run it
------
Expand Down
18 changes: 0 additions & 18 deletions bin/nginx/ai.lichess.org.conf

This file was deleted.

19 changes: 0 additions & 19 deletions bin/nginx/cache-file-descriptors.conf

This file was deleted.

File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions doc/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# /etc/hosts, assuming local domain 'l.org'

127.0.0.1 l.org
127.0.0.1 en.l.org
127.0.0.1 fr.l.org
127.0.0.1 socket.en.l.org
127.0.0.1 socket.fr.l.org
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 11 additions & 26 deletions bin/nginx/lichess.org.conf → doc/nginx/l.org.conf
Original file line number Diff line number Diff line change
@@ -1,66 +1,51 @@
# /etc/nginx/lichess.org.conf
# requires lila-proxy.conf
# assuming lila installed on /home/thib/lila
# running on 127.0.0.1:9000
# and using the local domain l.org

# redirect www.
server {
listen 80;
server_name www.l.org ~^www\.\w\w\.l\.org$;
return 301 http:https://l.org$request_uri;
}

# proxy websockets
server {
listen 80;
server_name ~^socket\.\w\w\.l\.org$;

charset utf-8;

location / {
include lila-proxy.conf;
proxy_read_timeout 5s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http:https://127.0.0.1:9000/;
}
}

# serve HTTP requests
server {
listen 80;
server_name l.org ~^\w\w\.l\.org$;

error_log /var/log/nginx/lila.error.log;

charset utf-8;

# static assets
location /assets {
# include cache-file-descriptors.conf;
# expires 6M;
# add_header Cache-Control "public";
alias /home/thib/lila/public;
}

# cached user game CSV exports
location /serve {
# expires 6M;
alias /home/thib/lila/serve;
}

location /import {
include lila-proxy.conf;
proxy_read_timeout 60s;
proxy_pass http:https://127.0.0.1:9000/import;
}

location / {
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
include lila-proxy.conf;
proxy_read_timeout 90s;
proxy_pass http:https://127.0.0.1:9000/;
}

error_page 500 501 502 503 /error.html;
error_page 504 /timeout.html;
location = /error.html {
root /home/thib/lila/public/;
}
location = /timeout.html {
root /home/thib/lila/public/;
}
location = /robots.txt {
root /home/thib/lila/public/;
}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 441d4e9

Please sign in to comment.