Skip to content

Instantly share code, notes, and snippets.

@mariocesar
Last active August 29, 2015 14:04
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mariocesar/3f3e63cd422e1024d7e5 to your computer and use it in GitHub Desktop.
Save mariocesar/3f3e63cd422e1024d7e5 to your computer and use it in GitHub Desktop.
Ubuntu Server + Nginx + Dropbox + uwsgi Apps

Install

Create a websites user.

sudo adduser --disabled-password --home /src/websites websites

Login and install dropbox.

sudo -s su - websites
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

Logged as the websites user, install the dropbox cli tool

mkdir bin
cd bin
wget https://www.dropbox.com/download?dl=packages/dropbox.py
chmod +x dropbox.py

Setup your DNS

Add a Website

Share a Website

# dropbox
description "starts the dropbox client"
start on runlevel [2345]
stop on shutdown
respawn
umask 0027
script
export LANG=en_US.UTF-8
exec su -s /bin/sh -c /srv/websites/.dropbox-dist/dropboxd websites
end script
map $http_accept_language $lang {
default es;
~en en;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
index index.html index.htm;
server_name ~^(www\.)?(?P<domain>.+)$;
root /srv/websites/Dropbox/Hosts;
location = /favicon.ico {
access_log off;
log_not_found off;
}
location ~ /[._]+ {
deny all;
return 404;
}
location / {
root /srv/websites/Dropbox/Hosts/$domain;
index index.html index.$lang.html;
autoindex on;
access_log /var/log/nginx/access.website-$domain.log;
error_log /var/log/nginx/error.website-$domain.log error;
try_files $uri $uri/ =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment