Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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