First post on 2015!
I have a raspberry pi several months ago, and I often use it to recording temp and humidity, uploading to a cloud host, but after a home movement, it had been stored in my drawer. Last day of 2014, while waiting 2015, I want build it and host an external disk for MacBookPro backup(Time Machine), but failed for power supply, normal power supply is not enough for raspi, so I should buy another USB Hub powered by itself.
My raspi used a wireless NIC to connecting with my router(OpenWrt), but I want use a ethernet cable for it, so it can get a unique IP on Internet, but when I pluged it, the wireless NIC would down, because of ifplugd or something else, so I keep the wireless NIC working and add some rules on route, port forward, WAN 80 to rasp 80, WAN 443 to rasp 443.
Install nginx viasudo apt-get install nginx
, remove default siterm /etc/nginx/sites-enable/default
, add conf in /etc/nginx/conf.d
, like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
I got a SSL certificate from nc.me(github student pack), so I rewrite HTTP to HTTPS.
start nginx via sudo nginx
or reload config via sudo nginx -s reload
.
Oh, your should update your domain A record to your router WAN ip address, you can write a script or use your router buildin DDNS function.
Octopress supported rsync publishment, so edit your Rakefile and enter your raspi ssh account and nginx html root path, like /usr/share/nginx/www
.
publish to github and rasp: rake gen_deploy rsync
or only to raspi: rake rsync
.