mirror of
https://github.com/bpetschowitsch/weba.git
synced 2026-06-01 16:39:42 +00:00
Create 10_redirect_http_https.md
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
# Redirect http to https
|
||||||
|
to allow only encrypted connections, modify nginx site configuration like this:
|
||||||
|
|
||||||
|
create a new server section like this:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
server_name *domain-name*
|
||||||
|
|
||||||
|
return 308 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
remove the:
|
||||||
|
* listen 80;
|
||||||
|
* listen [::]:80;
|
||||||
|
statements from the live configuration:
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl default_server;
|
||||||
|
listen [::]:443 ssl default_server;
|
||||||
|
|
||||||
|
server_name *
|
||||||
|
|
||||||
|
[...]
|
||||||
|
}
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user