User name is awinic. Current Date is Wednesday, October 23, 2024, current time is 05:23:36.mirror server {
    if ($host = mirror.awinic.ru) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name mirror.awinic.ru;
    


}

server {
    listen 443 ssl;
    server_name mirror.awinic.ru;

    ssl_certificate /etc/letsencrypt/live/mirror.awinic.ru/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mirror.awinic.ru/privkey.pem; # managed by Certbot


    # Recommended SSL settings
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers 'HIGH:!aNULL:!MD5';

    # Root and index settings
    root /var/www/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string; 
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        include fastcgi_params;
    }

    location /socket.io/ {
        proxy_pass http://unix:/run/rev.sock;
        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;
    }

    location /api/ {
        proxy_pass http://localhost:1337;  # Проксируем на локальный сервер
        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_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        # CORS заголовки
        proxy_set_header Access-Control-Allow-Origin "*";
        proxy_set_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
        proxy_set_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization";
        proxy_set_header Access-Control-Allow-Credentials "true";
    }

    # Node.js приложение на пути /rev
    location /rev/ {
        proxy_pass http://unix:/run/rev.sock;
        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_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        # Эти строки помогут проксировать CORS заголовки
        proxy_set_header Access-Control-Allow-Origin "*";
        proxy_set_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
        proxy_set_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization";
        proxy_set_header Access-Control-Allow-Credentials "true";
    } 
} ow.chats,conf # /etc/nginx/sites-available/ow_chats.conf

server {
    listen 80;
    server_name chat.longestsoloever.ru chat.awinic.ru chat.awinic.online;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name chat.longestsoloever.ru chat.awinic.ru chat.awinic.online;

    ssl_certificate /etc/letsencrypt/live/chat.awinic.online/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/chat.awinic.online/privkey.pem;

    location / {
        proxy_pass http://localhost:8080;
        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_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}