mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
ssl сертификат
This commit is contained in:
@@ -12,9 +12,23 @@ RUN npm run build
|
|||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Установка certbot
|
||||||
|
RUN apk add --no-cache certbot certbot-nginx
|
||||||
|
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
COPY docker/frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY docker/frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
# Создаем директории для сертификатов и certbot
|
||||||
|
RUN mkdir -p /etc/letsencrypt
|
||||||
|
RUN mkdir -p /var/www/certbot
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
# Копируем скрипты
|
||||||
|
COPY docker/frontend/ssl-renew.sh /etc/periodic/daily/ssl-renew
|
||||||
|
COPY docker/frontend/init-ssl.sh /docker-entrypoint.d/init-ssl.sh
|
||||||
|
RUN chmod +x /etc/periodic/daily/ssl-renew
|
||||||
|
RUN chmod +x /docker-entrypoint.d/init-ssl.sh
|
||||||
|
|
||||||
|
EXPOSE 80 443
|
||||||
|
|
||||||
|
# Запускаем crond и nginx
|
||||||
|
CMD ["sh", "-c", "crond && /docker-entrypoint.d/init-ssl.sh"]
|
23
docker/frontend/init-ssl.sh
Normal file
23
docker/frontend/init-ssl.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Остановка nginx
|
||||||
|
nginx -s stop || true
|
||||||
|
|
||||||
|
# Получение сертификата
|
||||||
|
certbot certonly --standalone \
|
||||||
|
--email crocoman7887@gmail.com \
|
||||||
|
--agree-tos \
|
||||||
|
--no-eff-email \
|
||||||
|
--staging \
|
||||||
|
-d itformhelp.ru
|
||||||
|
|
||||||
|
# После успешного получения сертификата в staging, получаем боевой сертификат
|
||||||
|
certbot certonly --standalone \
|
||||||
|
--email crocoman7887@gmail.com \
|
||||||
|
--agree-tos \
|
||||||
|
--no-eff-email \
|
||||||
|
--force-renewal \
|
||||||
|
-d itformhelp.ru
|
||||||
|
|
||||||
|
# Запуск nginx
|
||||||
|
nginx -g "daemon off;"
|
@@ -1,6 +1,32 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name itformhelp.ru;
|
||||||
|
|
||||||
|
# Редирект с HTTP на HTTPS
|
||||||
|
location / {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Для валидации Let's Encrypt
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root /var/www/certbot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name itformhelp.ru;
|
||||||
|
|
||||||
|
# SSL сертификаты
|
||||||
|
ssl_certificate /etc/letsencrypt/live/itformhelp.ru/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/itformhelp.ru/privkey.pem;
|
||||||
|
|
||||||
|
# Оптимизация SSL
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_prefer_server_ciphers off;
|
||||||
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
@@ -47,8 +73,6 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_page 404 /index.html;
|
error_page 404 /index.html;
|
||||||
|
|
||||||
# Redirect server error pages to the static page /50x.html
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
|
7
docker/frontend/ssl-renew.sh
Normal file
7
docker/frontend/ssl-renew.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Обновляем сертификат
|
||||||
|
certbot renew --quiet
|
||||||
|
|
||||||
|
# Перезагружаем nginx для применения обновленного сертификата
|
||||||
|
nginx -s reload
|
@@ -4,6 +4,18 @@
|
|||||||
<h1 class="text-2xl font-bold text-gray-900 mb-6">Создание заявки</h1>
|
<h1 class="text-2xl font-bold text-gray-900 mb-6">Создание заявки</h1>
|
||||||
|
|
||||||
<form @submit.prevent="handleSubmit" class="space-y-6 bg-white shadow-lg rounded-lg p-6">
|
<form @submit.prevent="handleSubmit" class="space-y-6 bg-white shadow-lg rounded-lg p-6">
|
||||||
|
<div>
|
||||||
|
<label for="title" class="block text-sm font-medium text-gray-700">Заголовок</label>
|
||||||
|
<input
|
||||||
|
id="title"
|
||||||
|
v-model="formData.title"
|
||||||
|
type="text"
|
||||||
|
class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md"
|
||||||
|
required
|
||||||
|
placeholder="Краткое описание проблемы"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="department" class="block text-sm font-medium text-gray-700">Отдел</label>
|
<label for="department" class="block text-sm font-medium text-gray-700">Отдел</label>
|
||||||
<select
|
<select
|
||||||
@@ -106,6 +118,7 @@ interface Employee {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
|
title: '',
|
||||||
department: '',
|
department: '',
|
||||||
request_type: '',
|
request_type: '',
|
||||||
priority: '',
|
priority: '',
|
||||||
@@ -137,7 +150,13 @@ const handleSubmit = async () => {
|
|||||||
throw new Error('Не найден токен авторизации')
|
throw new Error('Не найден токен авторизации')
|
||||||
}
|
}
|
||||||
|
|
||||||
await axios.post('/api/requests/', formData, {
|
const requestData = {
|
||||||
|
title: formData.title,
|
||||||
|
description: formData.description,
|
||||||
|
priority: formData.priority
|
||||||
|
}
|
||||||
|
|
||||||
|
await axios.post('/api/requests/', requestData, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${token}`
|
Authorization: `Bearer ${token}`
|
||||||
}
|
}
|
||||||
@@ -145,6 +164,7 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
success.value = true
|
success.value = true
|
||||||
// Очищаем форму
|
// Очищаем форму
|
||||||
|
formData.title = ''
|
||||||
formData.department = ''
|
formData.department = ''
|
||||||
formData.request_type = ''
|
formData.request_type = ''
|
||||||
formData.priority = ''
|
formData.priority = ''
|
||||||
|
Reference in New Issue
Block a user