This commit is contained in:
Ground-Zerro
2025-01-01 13:19:34 +11:00
parent 5ef44a1f17
commit df0c74deb9
2 changed files with 13 additions and 14 deletions

View File

@@ -44,7 +44,7 @@ echo "Устанавливаем зависимости Python..."
curl -o $APP_DIR/requirements.txt https://raw.githubusercontent.com/Ground-Zerro/DomainMapper/refs/heads/main/requirements.txt
# Установка зависимостей из requirements.txt и добавление необходимых библиотек
sudo -u $USERNAME bash -c "source $APP_DIR/venv/bin/activate && pip install -r $APP_DIR/requirements.txt fastapi uvicorn pydantic gunicorn"
sudo -u $USERNAME bash -c "source $APP_DIR/venv/bin/activate && pip install -r $APP_DIR/requirements.txt fastapi uvicorn pydantic"
# Загрузка файлов приложения
echo "Загружаем файлы приложения..."
@@ -81,27 +81,19 @@ sudo systemctl enable dns_resolver
echo "Настраиваем Nginx..."
sudo rm -f /etc/nginx/sites-enabled/default # Удаляем стандартный конфиг
# Конфигурация Nginx для работы с FastAPI
sudo tee $NGINX_CONF > /dev/null <<EOF
server {
listen 80;
server_name $DOMAIN_NAME;
server_name _;
root $APP_DIR;
index index.html;
# Проксируем запросы на FastAPI сервер
location / {
proxy_pass http://127.0.0.1:8000; # Uvicorn запускается на порту 8000 через Gunicorn
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
try_files \$uri /index.html;
}
# Обработка ошибки 404
error_page 404 /index.html;
location = /index.html {
root $APP_DIR;
internal;
}
}
EOF