Рефакторинг: вынес запуск ролей в отдельный файл deploy.yml
- Создан файл roles/deploy.yml с блоком запуска роли nginx - Обновлен molecule/default/site.yml для импорта deploy.yml - Улучшена модульность структуры проекта - Автор: Сергей Антропов
This commit is contained in:
67
roles/nginx/templates/default.conf.j2
Normal file
67
roles/nginx/templates/default.conf.j2
Normal file
@@ -0,0 +1,67 @@
|
||||
# Конфигурация виртуального хоста nginx
|
||||
# Автор: Сергей Антропов
|
||||
# Сайт: https://devops.org.ru
|
||||
# Сгенерировано: {{ ansible_date_time.iso8601 }}
|
||||
|
||||
server {
|
||||
listen {{ nginx_listen_port }};
|
||||
server_name {{ nginx_server_name }};
|
||||
|
||||
# Настройки безопасности
|
||||
{% if nginx_hide_version %}
|
||||
server_tokens off;
|
||||
{% endif %}
|
||||
|
||||
# Корневая директория
|
||||
root {{ nginx_root_dir }};
|
||||
index {{ nginx_index_file }};
|
||||
|
||||
# Настройки логов для этого виртуального хоста
|
||||
access_log {{ nginx_access_log }};
|
||||
error_log {{ nginx_error_log }};
|
||||
|
||||
# Основная локация
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# Настройки для статических файлов
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Настройки безопасности
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# Настройки для favicon
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Настройки для robots.txt
|
||||
location = /robots.txt {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# Настройки для health check
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
# Настройки для статуса nginx
|
||||
location /nginx_status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user