2014-12-27 10:09:00 +01:00
|
|
|
Useful nginx files that I will probably need and which I will forget if I
|
|
|
|
cannot read them from here.
|
2015-03-13 14:40:24 +01:00
|
|
|
|
2023-02-21 16:54:39 +01:00
|
|
|
---
|
2020-03-07 20:08:57 +01:00
|
|
|
|
|
|
|
## FUTURE WARNING
|
|
|
|
|
|
|
|
These files may age badly, so here are some hopefully timeless pointers:
|
|
|
|
|
2023-02-21 16:54:39 +01:00
|
|
|
- Generate the config file with https://ssl-config.mozilla.org/ (and if
|
2023-02-21 18:33:31 +01:00
|
|
|
time eats it, try https://github.com/mozilla/ssl-config-generator/ in
|
|
|
|
hope of finding where it is now. \* Name it 00-something so it will be the first file read and make
|
|
|
|
everything a different file.
|
2023-02-21 16:54:39 +01:00
|
|
|
- If using my acmesh-ssl.bash script, the files to fill should be like:
|
2020-03-07 20:08:57 +01:00
|
|
|
|
|
|
|
(the script runs `$ACMESH --key-file $NGINXDIR/key.pem --fullchain-file $NGINXDIR/cert.pem --reloadcmd "$SYSTEMCTLRESTART nginx"`)
|
|
|
|
|
2023-02-21 16:54:39 +01:00
|
|
|
- `ssl_certificate`, `ssl_trusted_certificate` are `cert.pem`
|
|
|
|
- `ssl_certificate_key` is `key.pem`
|
2020-03-07 20:08:57 +01:00
|
|
|
|
2023-02-21 16:54:39 +01:00
|
|
|
The header syntax is following, **_THIS LIKELY WON'T TIME WELL, ESPECIALLY CSP_**
|
2020-03-07 20:08:57 +01:00
|
|
|
|
|
|
|
```
|
2023-02-21 18:33:31 +01:00
|
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
|
|
add_header Content-Security-Policy "block-all-mixed-content; default-src 'none'; form-action 'self'; connect-src 'self' ws: wss:; style-src 'self' https: 'unsafe-inline'; script-src 'self'; worker-src 'self'; child-src 'self'; manifest-src 'self'; font-src 'self' https:; media-src 'self' https:; img-src 'self' data: https://user-images.githubusercontent.com" always;
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
add_header Referrer-Policy "no-referrer" always;
|
2020-03-07 20:08:57 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
The CSP comes from `HEAD "http://[::]:9000/#/chan-1"` to figure out what
|
|
|
|
TheLounge would be setting without a reverse proxy in front of it. `HEAD` is
|
|
|
|
in Debian package `libwww-perl`
|
|
|
|
|
2023-02-21 16:54:39 +01:00
|
|
|
- Refer to tester tools to see if the configuration is fine:
|
2023-02-21 18:33:31 +01:00
|
|
|
- https://observatory.mozilla.org/
|
|
|
|
- https://securityheaders.com/
|
|
|
|
- https://www.ssllabs.com/ssltest/
|
2020-03-07 20:08:57 +01:00
|
|
|
|
2023-02-21 16:54:39 +01:00
|
|
|
---
|
2020-03-07 20:08:57 +01:00
|
|
|
|
2015-04-22 21:40:18 +02:00
|
|
|
## Arch
|
2015-03-13 14:40:24 +01:00
|
|
|
|
|
|
|
Remove the default server block and add to http block:
|
|
|
|
|
|
|
|
```
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
|
|
include /etc/nginx/sites-enabled/*;
|
|
|
|
```
|
|
|
|
|
|
|
|
PHP: todo. It has something to do with `php-fpm.sock` instead of
|
|
|
|
`php5-fpm.sock`, but that doesn't appear to be enough.
|