Updated README, too
Getty Ritter
8 years ago
1 |
# |
|
1 | # melvil | |
2 | 2 | |
3 | 3 | **EARLY AND EXPERIMENTAL** |
4 | 4 | |
5 |
|
|
5 | Melvil is the HTTP server interface I want to use. It's very | |
6 | 6 | slow at present, and still quite early, but it's at least a |
7 | 7 | proof-of-concept of something I think should exist. |
8 | 8 | |
9 | 9 | ## Basic Use |
10 | 10 | |
11 |
The |
|
11 | The Melvil server does nothing but pass HTTP requests and | |
12 | 12 | responses between other servers: it is, in effect, a mechanism |
13 | 13 | for establishing reverse proxies. |
14 | 14 | |
43 | 43 | |
44 | 44 | - The `mode` field tells us _how_ to forward requests. There are |
45 | 45 | three possible forwarding modes: |
46 |
- If the mode is `http`, then |
|
46 | - If the mode is `http`, then Melvil will forward the HTTP | |
47 | 47 | request to the server listening on the host `host` and the |
48 | 48 | port `port`. |
49 |
- If the mode is ` |
|
49 | - If the mode is `melvil`, then Melvil will recursively check | |
50 | 50 | the configuration directory at `conf`. |
51 |
- If the mode is `redir`, then |
|
51 | - If the mode is `redir`, then Melvil will respond with an | |
52 | 52 | HTTP response code as indicated in `resp` and redirect to |
53 | 53 | the host as indicated in `host`. |
54 | 54 | |
62 | 62 | to that user on a per-subdomain basis: |
63 | 63 | |
64 | 64 | ~~~ |
65 | $ mkdir -p /var/run/aloys | |
66 | $ for U in $USERS | |
67 | > do | |
65 | $ mkdir -p /etc/melvil | |
66 | $ for U in $USERS; do | |
68 | 67 | > # find the user's home directory |
69 | 68 | > HOMEDIR=`cat /etc/passwd | grep ${U} | cut -d ':' -f 6` |
70 | 69 | > |
71 | 70 | > # add a configuration directory to each user |
72 | > mkdir -p ${HOMEDIR}/aloys | |
73 | > chown ${U} ${HOMEDIR}/aloys | |
71 | > mkdir -p ${HOMEDIR}/melvil | |
72 | > chown ${U} ${HOMEDIR}/melvil | |
74 | 73 | > |
75 | 74 | > # add a new forwarding rule for each user |
76 | > mkdir -p /var/run/aloys/${U}-local | |
77 | > # make ${U}.example.com forward to the user's aloys configuration | |
78 | > echo "${U}.example.com" >/var/run/aloys/user-${U}/domain | |
79 | > echo "aloys" >/var/run/aloys/user-${U}/mode | |
80 |
> |
|
75 | > mkdir -p /etc/${U}-local | |
76 | > | |
77 | > # make ${U}.example.com forward to the user's melvil configuration | |
78 | > echo "${U}.example.com" >/melvil/user-${U}/domain | |
79 | > echo "melvil" >/melvil/user-${U}/mode | |
80 | > echo "${HOMEDIR}/melvil" >/melvil/user-${U}/conf | |
81 | 81 | > done |
82 |
$ aloysius / |
|
82 | $ aloysius /etc/melvil | |
83 | 83 | ~~~ |
84 | 84 | |
85 | 85 | Now, if a given user wants to set up a local HTTP server that |