mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Refactored native-
This commit is contained in:
3
roles/nginx/handlers/main.yml
Normal file
3
roles/nginx/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- name: restart nginx
|
||||
service: name=nginx state=restarted enabled=yes
|
14
roles/nginx/readme.md
Normal file
14
roles/nginx/readme.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# role nginx
|
||||
|
||||
## debug
|
||||
```bash
|
||||
journalctl -f -u nginx
|
||||
```
|
||||
## performance
|
||||
- https://www.monitis.com/blog/6-best-practices-for-optimizing-your-nginx-performance/
|
||||
- https://www.nginx.com/blog/tuning-nginx/
|
||||
- https://davidwalsh.name/enable-gzip
|
||||
- https://www.nginx.com/blog/performance-tuning-tips-tricks/
|
||||
- https://medium.com/pixelpoint/best-practices-for-cache-control-settings-for-your-website-ff262b38c5a2
|
||||
- https://www.nginx.com/blog/nginx-caching-guide/
|
||||
- https://meta.discourse.org/t/using-nginx-as-proxy-server-is-very-slow-but-it-is-very-fast-if-using-nginx-in-docker-why/168972
|
17
roles/nginx/tasks/main.yml
Normal file
17
roles/nginx/tasks/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: install nginx
|
||||
pacman: name=nginx state=present
|
||||
notify: restart nginx
|
||||
|
||||
- name: set /etc/nginx/conf.d
|
||||
file:
|
||||
path: /etc/nginx/conf.d
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: create nginx config file
|
||||
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf
|
||||
notify: restart nginx
|
||||
|
||||
- name: flush nginx service
|
||||
meta: flush_handlers
|
34
roles/nginx/templates/nginx.conf.j2
Normal file
34
roles/nginx/templates/nginx.conf.j2
Normal file
@@ -0,0 +1,34 @@
|
||||
worker_processes auto;
|
||||
|
||||
events
|
||||
{
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http
|
||||
{
|
||||
include mime.types;
|
||||
default_type text/html;
|
||||
|
||||
# caching
|
||||
proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache:20m max_size=20g inactive=14d use_temp_path=off;
|
||||
|
||||
# logs
|
||||
access_log syslog:server=unix:/dev/log;
|
||||
error_log syslog:server=unix:/dev/log;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# gzip
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.(?!.*SV1)"; # Disable for Internetexplorer 6
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
gzip_types application/atom+xml application/javascript application/xml+rss application/x-javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/javascript text/xml;
|
||||
|
||||
types_hash_max_size 4096;
|
||||
include conf.d/*.conf;
|
||||
}
|
Reference in New Issue
Block a user