Servus Miteinander,
gester ist auch endlich meine Alexa angekommen.
ich hab mich dann gleich gestern Abend auch mal durch den Amazon wirrwarr gekämpft, ich frage mich wer sowas ohne Anleitung schafft, und wer sich sowas ausdenkt.
Den Skill bekomme ich in der APP angezeigt, wenn ich auf Testen gegangen bin, hat er mir in der Console auch lustige Meldungen gebracht.
Also irgendwas macht schon mal was.
Jetzt haperts aber enorm am Verständnis zum nginx.
Ich hab mir die nginx.md aus dem Plugin Verzeichnis genommen, und bin danach Vorgegangen, bekomm aber immer die Fehlermeldung:
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
Jetzt hab ich rumprobiert, gesucht und gemacht, und mir ist nicht ganz klar, was ich jetzt alles beim nginx einstellen muss.
die nginx.md hab ich mal mit meinen Unklarheiten ergänzt.
# /etc/nginx/include.d/common
```
# letsencrypt shizzle
ssl_certificate /etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/fullchain.pem; <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ?? DYNDNS WIRD MEINE ADRESSE in meinem Fall xxx.xxx.myfritz.net
ssl_certificate_key /etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/privkey.pem; <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ?? DYNDNS WIRD MEINE ADRESSE in meinem Fall xxx.xxx.myfritz.net
ssl_stapling on;
ssl_stapling_verify on;
# maintain the .well-known directory alias for letsencrypt & renewals
location /.well-known {
auth_basic off;
alias /var/www/.well-known; <------------- HEISST DER WIRKLICH SO, ODER MUSS ICH WAS ÄNDERN ???
}
```
# /etc/nginx/sites-available/your-home <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
```
# SSL-Redirect & LetsEncrypt Endpoint
server {
listen 80 default_server;
# redirect every requested $host (any, even invalid ones) to its SSL URL
location / {
return 301 https://$host$request_uri;
}
# LetsEncrypt Endpoint
location /.well-known {
alias /var/www/.well-known; <------------- HEISST DER WIRKLICH SO ODER MUSS ICH WAS ÄNDERN ???
}
}
# Sitemap
server {
listen 443 ssl default_server;
access_log /var/log/nginx/sitemap.log combined;
auth_basic "YOUR-HOME.DYNDNS.TLD"; <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ?? DYNDNS WIRD MEINE ADRESSE in meinem Fall xxx.xxx.myfritz.net ??
auth_basic_user_file /etc/nginx/htpasswd;
include /etc/nginx/include.d/common;
#add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
root /var/www/sitemap;
index index.html;
}
}
# Alexa
server {
listen 443 ssl;
server_name ALEXA.YOUR-HOME.DYNDNS.TLD;
access_log /var/log/nginx/alexa.log combined;
auth_basic "Alexa";
auth_basic_user_file /etc/nginx/htpasswd.alexa;
include /etc/nginx/include.d/common;
location / {
proxy_pass http://192.168.16.5:9000/; <--------------- WIRD MEINE LOKALE ADRESSE AUF DER SMARTHOMENG LÄUFT ?
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD
server {
listen 443 ssl;
server_name ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD;
access_log /var/log/nginx/ANOTHER-SERVICE.log combined;
auth_basic "ANOTHER-SERVICE";
auth_basic_user_file /etc/nginx/htpasswd; BRAUCHE ICH DEN ABSCHNITT ÜBERHAUPT ??
include /etc/nginx/include.d/common;
location / {
proxy_pass http://192.168.16.6/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
# /etc/nginx/sites-enabled/your-home <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
just create a symlink in `/etc/nginx/sites-enabled/` that points to your config:
`sudo ln -s /etc/nginx/sites-enabled/your-home /etc/nginx/sites-available/your-home`
# Sitemap
You can create a Sitemap at /var/www/sitemap/index.html to give a nice overview of your services
```
<!doctype html>
<html>
<head>
<title>YOU-HOME</title>
</head>
<body>
<ul>
<li><a href="https://alexa.YOUR-HOME.TLD/">Alexa</a></li> <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
<li><a href="https://ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD/">Another Service</a></li>
</ul>
</body>
</html>
```
# User & Passwords
/etc/nginx/htpasswd
format is `user
assword`
generate passwords using `openssl passwd "YOUR-PASSWORD"`
# Let's Encrypt SSL Certificate
- download certbot from https://certbot.eff.org/
- create certificates: `sudo certbot certonly --webroot -w /var/www -d YOUR-HOME.DYNDNS.TLD -d ALEXA.YOUR-HOME.DYNDNS.TLD -d ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD` <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
Vielleicht kann mir als NGINX Vollnoob, jemand aus der Patsche helfen.
Vielen dank Schonmal
Gruß Wolfi
gester ist auch endlich meine Alexa angekommen.
ich hab mich dann gleich gestern Abend auch mal durch den Amazon wirrwarr gekämpft, ich frage mich wer sowas ohne Anleitung schafft, und wer sich sowas ausdenkt.
Den Skill bekomme ich in der APP angezeigt, wenn ich auf Testen gegangen bin, hat er mir in der Console auch lustige Meldungen gebracht.
Also irgendwas macht schon mal was.
Jetzt haperts aber enorm am Verständnis zum nginx.
Ich hab mir die nginx.md aus dem Plugin Verzeichnis genommen, und bin danach Vorgegangen, bekomm aber immer die Fehlermeldung:
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
Jetzt hab ich rumprobiert, gesucht und gemacht, und mir ist nicht ganz klar, was ich jetzt alles beim nginx einstellen muss.
die nginx.md hab ich mal mit meinen Unklarheiten ergänzt.
# /etc/nginx/include.d/common
```
# letsencrypt shizzle
ssl_certificate /etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/fullchain.pem; <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ?? DYNDNS WIRD MEINE ADRESSE in meinem Fall xxx.xxx.myfritz.net
ssl_certificate_key /etc/letsencrypt/live/YOUR-HOME.DYNDNS.TLD/privkey.pem; <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ?? DYNDNS WIRD MEINE ADRESSE in meinem Fall xxx.xxx.myfritz.net
ssl_stapling on;
ssl_stapling_verify on;
# maintain the .well-known directory alias for letsencrypt & renewals
location /.well-known {
auth_basic off;
alias /var/www/.well-known; <------------- HEISST DER WIRKLICH SO, ODER MUSS ICH WAS ÄNDERN ???
}
```
# /etc/nginx/sites-available/your-home <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
```
# SSL-Redirect & LetsEncrypt Endpoint
server {
listen 80 default_server;
# redirect every requested $host (any, even invalid ones) to its SSL URL
location / {
return 301 https://$host$request_uri;
}
# LetsEncrypt Endpoint
location /.well-known {
alias /var/www/.well-known; <------------- HEISST DER WIRKLICH SO ODER MUSS ICH WAS ÄNDERN ???
}
}
# Sitemap
server {
listen 443 ssl default_server;
access_log /var/log/nginx/sitemap.log combined;
auth_basic "YOUR-HOME.DYNDNS.TLD"; <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ?? DYNDNS WIRD MEINE ADRESSE in meinem Fall xxx.xxx.myfritz.net ??
auth_basic_user_file /etc/nginx/htpasswd;
include /etc/nginx/include.d/common;
#add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
root /var/www/sitemap;
index index.html;
}
}
# Alexa
server {
listen 443 ssl;
server_name ALEXA.YOUR-HOME.DYNDNS.TLD;
access_log /var/log/nginx/alexa.log combined;
auth_basic "Alexa";
auth_basic_user_file /etc/nginx/htpasswd.alexa;
include /etc/nginx/include.d/common;
location / {
proxy_pass http://192.168.16.5:9000/; <--------------- WIRD MEINE LOKALE ADRESSE AUF DER SMARTHOMENG LÄUFT ?
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
# ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD
server {
listen 443 ssl;
server_name ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD;
access_log /var/log/nginx/ANOTHER-SERVICE.log combined;
auth_basic "ANOTHER-SERVICE";
auth_basic_user_file /etc/nginx/htpasswd; BRAUCHE ICH DEN ABSCHNITT ÜBERHAUPT ??
include /etc/nginx/include.d/common;
location / {
proxy_pass http://192.168.16.6/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
# /etc/nginx/sites-enabled/your-home <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
just create a symlink in `/etc/nginx/sites-enabled/` that points to your config:
`sudo ln -s /etc/nginx/sites-enabled/your-home /etc/nginx/sites-available/your-home`
# Sitemap
You can create a Sitemap at /var/www/sitemap/index.html to give a nice overview of your services
```
<!doctype html>
<html>
<head>
<title>YOU-HOME</title>
</head>
<body>
<ul>
<li><a href="https://alexa.YOUR-HOME.TLD/">Alexa</a></li> <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
<li><a href="https://ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD/">Another Service</a></li>
</ul>
</body>
</html>
```
# User & Passwords
/etc/nginx/htpasswd
format is `user

generate passwords using `openssl passwd "YOUR-PASSWORD"`
# Let's Encrypt SSL Certificate
- download certbot from https://certbot.eff.org/
- create certificates: `sudo certbot certonly --webroot -w /var/www -d YOUR-HOME.DYNDNS.TLD -d ALEXA.YOUR-HOME.DYNDNS.TLD -d ANOTHER-SERVICE.YOUR-HOME.DYNDNS.TLD` <---------------- MUSS ICH YOUR-HOME DURCH ETWAS ERSETZEN ??
Vielleicht kann mir als NGINX Vollnoob, jemand aus der Patsche helfen.
Vielen dank Schonmal
Gruß Wolfi
Kommentar