Добавлен .env.production для корректной работы на проде. Улучшен nginx.conf Добавлен скрипт деплоя.
This commit is contained in:
parent
0a1a5d65d5
commit
23bd232504
2
.env.production
Normal file
2
.env.production
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
VITE_API_URL=https://russcult.anibilag.ru
|
||||||
|
VITE_APP_ENV=production
|
@ -1,22 +1,13 @@
|
|||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
root /var/www/dist;
|
root /var/www/dist;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
server_name russcult.anibilag.ru;
|
server_name russcult.anibilag.ru;
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://192.168.1.67:5000;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# Gzip compression
|
||||||
gzip on;
|
gzip on;
|
||||||
|
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
@ -26,5 +17,32 @@ server {
|
|||||||
gzip_http_version 1.1;
|
gzip_http_version 1.1;
|
||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache static assets
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Security headers
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://192.168.1.67:5000/api/; # 👈 сохраняем /api/ в пути
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
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;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
|
||||||
error_page 404 /index.html;
|
error_page 404 /index.html;
|
||||||
}
|
}
|
||||||
|
21
deploy.sh
Normal file
21
deploy.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# deploy.sh
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# Backup current deployment
|
||||||
|
sudo cp -r /var/www/dist /var/www/dist.backup.$(date +%Y%m%d_%H%M%S)
|
||||||
|
|
||||||
|
# Deploy new build
|
||||||
|
sudo rm -rf /var/www/dist/*
|
||||||
|
sudo cp -r dist/* /var/www/dist/
|
||||||
|
|
||||||
|
# Set proper permissions
|
||||||
|
sudo chown -R www-data:www-data /var/www/dist
|
||||||
|
sudo chmod -R 755 /var/www/dist
|
||||||
|
|
||||||
|
# Test nginx config and reload
|
||||||
|
sudo nginx -t && sudo systemctl reload nginx
|
||||||
|
|
||||||
|
echo "Deployment completed successfully!"
|
@ -12,8 +12,6 @@ export function HomePage() {
|
|||||||
const categoryId = searchParams.get('category');
|
const categoryId = searchParams.get('category');
|
||||||
const backgroundImage= BackgroundImages[Number(categoryId)];
|
const backgroundImage= BackgroundImages[Number(categoryId)];
|
||||||
|
|
||||||
console.log(categoryId)
|
|
||||||
|
|
||||||
const getHeroTitle = () => {
|
const getHeroTitle = () => {
|
||||||
if (categoryId) {
|
if (categoryId) {
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user