Created
January 5, 2010 20:32
-
-
Save dysinger/269688 to your computer and use it in GitHub Desktop.
A simple nginx/webdav setup for use with things like mobile-org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# on ubuntu: need some utils & dev libs | |
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev | |
# compile nginx | |
cd /tmp | |
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz | |
cd nginx* | |
./configure --with-http_ssl_module --with-http_dav_module \ | |
--prefix=$HOME/nginx | |
make && make install | |
# generate an htpasswd file | |
htpasswd -c ~/.htpasswd $(whoami) | |
# ssl | |
openssl genrsa 1024 > ~/nginx/conf/server.key | |
openssl req -new -x509 -nodes -sha1 -days 365 \ | |
-key ~/nginx/conf/server.key > ~/nginx/conf/server.crt | |
# configure | |
cat > ~/nginx/conf/nginx.conf <<EOF | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
ssl_certificate server.crt; | |
ssl_certificate_key server.key; | |
auth_basic "Restricted"; | |
auth_basic_user_file $HOME/.htpasswd; | |
dav_methods put delete mkcol copy move; | |
dav_access user:rw; | |
create_full_put_path on; | |
server { | |
listen 1080; | |
listen 1443 ssl; | |
location ~ ^/org(/.*)?$ { | |
alias $HOME/org/mobile\$1; | |
} | |
} | |
} | |
EOF | |
# now you can start nginx | |
~/nginx/sbin/nginx | |
# and then sync w/ org-mobile-push/pull & mobileorg sync | |
# URL: http://<my-nginx-ip-addr>:1080/org/index.org | |
# or use | |
# URL: https://<my-nginx-ip-addr>:1443/org/index.org | |
# and your username and password you used above for htpasswd |
Simple note here for webdav setups, you'll probably also want:
dav_ext_methods propfind options;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is also a dependency on "gcc" and "make" which is not installed by default.
A fix would be to change line 4 to look like this:
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev make gcc