amduser/amd_user_local1
1
1#!/bin/sh2set -e3 4if [ -z "$UUID" ]; then5 echo "❌ UUID را در Variables تعریف کنید!"6 exit 17fi8 9WSPATH=${WSPATH:-/api/v1/aichatbot}10 11cat > /etc/xray/config.json << EOF12{13 "log": {"loglevel": "warning"},14 "inbounds": [{15 "port": 9000,16 "listen": "127.0.0.1",17 "protocol": "vless",18 "settings": {19 "clients": [{"id": "${UUID}"}], # flow رو حذف کن20 "decryption": "none"21 },22 "streamSettings": {23 "network": "ws",24 "wsSettings": {"path": "${WSPATH}"}25 }26 }],27 "outbounds": [{"protocol": "freedom"}]28}29EOF30 31echo "✅ دمو AI راهاندازی شد | Path: ${WSPATH}"32 33cat > /tmp/nginx.conf << EOF34pid /tmp/nginx.pid;35 36events { worker_connections 1024; }37 38http {39 client_body_temp_path /tmp/nginx/client_body 1 2;40 proxy_temp_path /tmp/nginx/proxy;41 fastcgi_temp_path /tmp/nginx/fastcgi;42 uwsgi_temp_path /tmp/nginx/uwsgi;43 scgi_temp_path /tmp/nginx/scgi;44 45 server {46 listen 7860 default_server;47 server_name _;48 49 access_log /var/log/nginx/access.log;50 error_log /var/log/nginx/error.log warn;51 52 location / {53 root /www;54 index index.html;55 try_files \$uri \$uri/ =404;56 }57 58 location ${WSPATH} {59 proxy_pass http://127.0.0.1:9000;60 proxy_http_version 1.1;61 proxy_set_header Upgrade \$http_upgrade;62 proxy_set_header Connection "upgrade";63 proxy_set_header Host \$host;64 proxy_set_header X-Real-IP \$remote_addr;65 proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;66 proxy_set_header X-Forwarded-Proto \$scheme;67 proxy_set_header Origin "https://chat.openai.com"; # برای obfuscation اضافی68 proxy_read_timeout 86400;69 }70 }71}72EOF73 74echo "nginx.conf ساخته شد با WSPATH: ${WSPATH}"75grep "location" /tmp/nginx.conf76 77ai-core run -config /etc/xray/config.json &78 79exec nginx -c /tmp/nginx.conf -g "daemon off;"