mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 13:26:54 +00:00
Updating nginx docs for clarity (#2561)
* Update nginx docs Added step to remove passphrase from self-signed cert private key. Removed http block since enabled sites now are included inside the http block in modern nginx configs * Update nginx.markdown Added note about sites-available directory in RPM-based distros (and possibly others)
This commit is contained in:
parent
9fcfb2368a
commit
243a1efa74
@ -40,6 +40,7 @@ If you do not own your own domain, you may generate a self-signed certificate. T
|
|||||||
|
|
||||||
```
|
```
|
||||||
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999
|
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999
|
||||||
|
openssl rsa -in key.pem -out key.pem
|
||||||
sudo cp key.pem cert.pem /etc/nginx/ssl
|
sudo cp key.pem cert.pem /etc/nginx/ssl
|
||||||
sudo chmod 600 /etc/nginx/ssl/key.pem /etc/nginx/ssl/cert.pem
|
sudo chmod 600 /etc/nginx/ssl/key.pem /etc/nginx/ssl/cert.pem
|
||||||
sudo chown root:root /etc/nginx/ssl/key.pem /etc/nginx/ssl/cert.pem
|
sudo chown root:root /etc/nginx/ssl/key.pem /etc/nginx/ssl/cert.pem
|
||||||
@ -58,6 +59,10 @@ sudo openssl dhparam -out dhparams.pem 2048
|
|||||||
|
|
||||||
Create a new file `/etc/nginx/sites-available/hass` and copy the configuration file at the bottom of the page into it.
|
Create a new file `/etc/nginx/sites-available/hass` and copy the configuration file at the bottom of the page into it.
|
||||||
|
|
||||||
|
<p class='note'>
|
||||||
|
Some Linux distributions (including CentOS and Fedora) will not have the `/etc/nginx/sites-available/` directory. In this case, remove the default server {} block from the `/etc/nginx/nginx.conf` file and paste the contents from the bottom of the page in its place. If doing this, proceed to step 7.
|
||||||
|
</p>
|
||||||
|
|
||||||
### {% linkable_title 6. Enable the Home Assistant configuration. %}
|
### {% linkable_title 6. Enable the Home Assistant configuration. %}
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -78,22 +83,21 @@ Forward ports 443 and 80 to your server on your router. Do not forward port 8123
|
|||||||
### {% linkable_title NGINX Config %}
|
### {% linkable_title NGINX Config %}
|
||||||
|
|
||||||
```
|
```
|
||||||
http {
|
map $http_upgrade $connection_upgrade {
|
||||||
map $http_upgrade $connection_upgrade {
|
|
||||||
default upgrade;
|
default upgrade;
|
||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
# Update this line to be your domain
|
# Update this line to be your domain
|
||||||
server_name example.com;
|
server_name example.com;
|
||||||
|
|
||||||
# These shouldn't need to be changed
|
# These shouldn't need to be changed
|
||||||
listen [::]:80 default_server ipv6only=off;
|
listen [::]:80 default_server ipv6only=off;
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
# Update this line to be your domain
|
# Update this line to be your domain
|
||||||
server_name example.com;
|
server_name example.com;
|
||||||
|
|
||||||
@ -128,6 +132,5 @@ http {
|
|||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection $connection_upgrade;
|
proxy_set_header Connection $connection_upgrade;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user