Добавил playbook для установки и конфигурации nginx+загрузки файлов
This commit is contained in:
parent
9e1bcd3f9a
commit
9e148c7965
71
files/nginx.conf
Normal file
71
files/nginx.conf
Normal file
@ -0,0 +1,71 @@
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
root /var/www;
|
||||
|
||||
index index.html index.htm;
|
||||
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
37
playbook.yml
Normal file
37
playbook.yml
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
tasks:
|
||||
- name: Install nginx
|
||||
become: yes
|
||||
apt:
|
||||
name: nginx-light
|
||||
update_cache: yes
|
||||
state: latest
|
||||
- name: Create dir
|
||||
file:
|
||||
path: /var/www
|
||||
state: directory
|
||||
- name: Copy repo files
|
||||
become: yes
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: /var/www
|
||||
owner: www-data
|
||||
group: www-data
|
||||
with_fileglob:
|
||||
- src/*
|
||||
- name: Copy config file
|
||||
become: yes
|
||||
copy:
|
||||
src: files/nginx.conf
|
||||
dest: /etc/nginx/nginx.conf
|
||||
owner: root
|
||||
notify:
|
||||
- Reload nginx
|
||||
handlers:
|
||||
- name: Reload nginx
|
||||
become: yes
|
||||
service:
|
||||
name: nginx
|
||||
state: restarted
|
Loading…
Reference in New Issue
Block a user