This shows you the differences between two versions of the page.
— |
computer_science:software:linux:motion_eye [2016/12/11 19:18] (current) thomas created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Reverse HTTPS Proxy with lighttpd ====== | ||
+ | [[https://bitbucket.org/ccrisan/motioneye/wiki/Improved%20Security%20over%20HTTPS%20proxy%20with%20lighttpd%20RasPi%20and%20any%20other%20Debian%20Distro|Original page]] | ||
+ | ===== Install lighttpd and openssl ===== | ||
+ | <code> | ||
+ | sudo apt-get update && sudo apt-get upgrade | ||
+ | sudo apt-get install lighttpd | ||
+ | sudo apt-get install openssl | ||
+ | </code> | ||
+ | ===== Generate certificate ===== | ||
+ | <code> | ||
+ | sudo mkdir /etc/lighttpd/certs | ||
+ | sudo openssl req -new -x509 -keyout /etc/lighttpd/certs/lighttpd.pem -out /etc/lighttpd/certs/lighttpd.pem -days 365 -nodes | ||
+ | sudo chmod 400 /etc/lighttpd/certs/lighttpd.pem | ||
+ | </code> | ||
+ | ===== Configure lighthttpd ===== | ||
+ | Edit the lighttpd.conf file: <code>sudo nano /etc/lighttpd/lighttpd.conf</code> | ||
+ | In server.modules section add a new line: <code>"mod_proxy",</code> | ||
+ | At the end of the file add the complete block: | ||
+ | <code>$SERVER["socket"] == "0.0.0.0:5557" { | ||
+ | proxy.server = ( "" => | ||
+ | (( "host" => "0.0.0.0", "port" => 8765 )) | ||
+ | ) | ||
+ | ssl.engine = "enable" | ||
+ | ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem" | ||
+ | }</code> | ||
+ | |||
+ | <code>sudo service lighttpd restart</code> | ||
+ | Check if lighttpd restarted correctly: <code>sudo journalctl -xn | ||
+ | </code> | ||