====== NGINX ======
Idee, den [[fhem|FHEM]] aus der Ferne steuern zu können wie hier ((https://haus-automatisierung.com/hardware/fhem/2016/12/30/fhem-tutorial-reihe-part-21-zugriff-auf-fhem-ueber-das-internet.html))
Quelle ua ((https://community.openhab.org/t/using-nginx-reverse-proxy-authentication-and-https/14542))
Schnellere, kleinere Alternative zu Apache
===== Reverse Proxy =====
Redirect (bzw. proxy), um eine andere Webseite aufzurufen.
sudo nano /etc/nginx/sites-enabled/default
In 'Server'
location ~/fhem(.*)$ {
proxy_pass http://127.0.0.1:8083/fhem$1$is_args$args;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
===== SSL =====
sudo mkdir -p /etc/ssl/certs
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/openhab.key -out /etc/ssl/openhab.crt
In the NGINX configuration, place the following underneath your server_name variable:
ssl_certificate /etc/ssl/openhab.crt;
ssl_certificate_key /etc/ssl/openhab.key;
===== Passwort =====
sudo htpasswd -c /etc/nginx/.htpasswd [mein-username]
Now the configuration file (/etc/nginx/sites-enabled/default) needs to be edited to use this password. Open the configuration file and add the following lines underneath the proxy_* settings:
auth_basic "Username and Password Required";
auth_basic_user_file /etc/nginx/.htpasswd;