Changes in Dockerfile and nginx conf

This commit is contained in:
nyan404 committed 2025-03-18 22:28:43 +03:00
1 parent b3ae0298ee
commit 358eee6348
2 files changed
+23 -9

No files matched your search

+11 -6
View File
@@ -1,16 +1,21 @@
# Use the official nginx base image
# Используем официальный образ nginx
FROM nginx
# Copy the site files from the local /web folder to the container's /usr/share/nginx/html folder
# Устанавливаем локаль UTF-8 (решает проблемы внутри контейнера)
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
# Копируем файлы сайта
COPY ./web /usr/share/nginx/html
# Copy the custom nginx config file
# Копируем кастомный конфиг nginx
COPY nginx.conf /etc/nginx/nginx.conf
# Expose port 80 for HTTP traffic
# Выставляем правильные разрешения (важно для контейнера!)
RUN chmod -R 755 /usr/share/nginx/html && chown -R nginx:nginx /usr/share/nginx/html
# Открываем порты
EXPOSE 80
# Expose port 443 for HTTPs traffic
EXPOSE 443
# Start the nginx server
# Запускаем nginx
CMD ["nginx", "-g", "daemon off;"]
+12 -3
View File
@@ -5,8 +5,8 @@ error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 2048; # Увеличено для поддержки большего количества одновременных соединений
multi_accept on; # Позволяет принимать несколько новых соединений за раз
worker_connections 2048;
multi_accept on;
}
http {
@@ -26,11 +26,14 @@ http {
keepalive_timeout 30;
client_max_body_size 10M;
gzip on; # Включает сжатие для ускорения загрузки
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 1000;
gzip_comp_level 2;
charset utf-8;
charset_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/x-javascript;
server {
listen 80;
server_name localhost;
@@ -45,6 +48,12 @@ http {
autoindex_localtime on;
}
location ~* \.(js)$ {
types { application/javascript js; }
charset utf-8;
add_header Content-Type application/javascript;charset=utf-8;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;