mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-02-22 12:29:39 +01:00
Added detailled logging for nginx
This commit is contained in:
parent
b788a7e32b
commit
280ef536da
@ -1,9 +1,22 @@
|
||||
# role nginx
|
||||
This role sets up an nginx server. It was developed by [Kevin Veen-Birkenbach](https://www.veen.world).
|
||||
## Debug
|
||||
|
||||
## debug
|
||||
### General Debugging
|
||||
```bash
|
||||
journalctl -f -u nginx
|
||||
```
|
||||
|
||||
### Detailled Debugging
|
||||
Set ``enable_debugenable_debug: true``.
|
||||
#### Follow logs of one host
|
||||
```bash
|
||||
journalctl -u nginx -f | grep "<<hostname>>"
|
||||
```
|
||||
|
||||
|
||||
### Activate detailled Debugging:
|
||||
|
||||
## performance
|
||||
- https://www.monitis.com/blog/6-best-practices-for-optimizing-your-nginx-performance/
|
||||
- https://www.nginx.com/blog/tuning-nginx/
|
||||
|
@ -17,8 +17,22 @@ http
|
||||
# caching
|
||||
proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache:20m max_size=20g inactive=14d use_temp_path=off;
|
||||
|
||||
# logs
|
||||
# logging and debugging
|
||||
{% if enable_debug | bool %}
|
||||
# individual log format for better debugging
|
||||
log_format debug '$host - $remote_addr [$time_local] '
|
||||
'"$request" $status $body_bytes_sent '
|
||||
'"Referer: $http_referer" '
|
||||
'"User-Agent: $http_user_agent" '
|
||||
'"ReqTime: $request_time" "UpstreamTime: $upstream_response_time" '
|
||||
'"ReqLength: $request_length" "BytesSent: $bytes_sent" '
|
||||
'"ConnRequests: $connection_requests" '
|
||||
'"X-Forwarded-For: $http_x_forwarded_for" '
|
||||
'"Scheme: $scheme" "Protocol: $server_protocol" "ServerName: $server_name"';
|
||||
access_log syslog:server=unix:/dev/log debug;
|
||||
{% else %}
|
||||
access_log syslog:server=unix:/dev/log;
|
||||
{% endif %}
|
||||
error_log syslog:server=unix:/dev/log;
|
||||
|
||||
sendfile on;
|
||||
|
Loading…
x
Reference in New Issue
Block a user