Nginx Configuration
Nginx Setup
Prerequisites
Last updated
Last updated
sudo mkdir -p /var/www
cd /var/www
git clone <YOUR_BOT_REPOSITORY_URL>
ls
sudo mv /var/www/<CLONED_FOLDER_NAME> /var/www/aegisbot # Ensure the folder is named aegisbotcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
\. "$HOME/.nvm/nvm.sh"
nvm install 21.7.3
nvm use 21.7.3
node -vsudo apt update
sudo apt install -y nginxsudo nano /etc/nginx/sites-available/dashboard.your-domain.comserver {
listen 80;
server_name dashboard.your-domain.com;
location / {
root /var/www/aegisbot/dashboard/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
add_header Referrer-Policy "strict-origin-when-cross-origin";
}sudo ln -s /etc/nginx/sites-available/dashboard.your-domain.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxsudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d dashboard.your-domain.comcd /var/www/aegisbot
sudo nano config.ymlcd /var/www/aegisbot
npm install
npm run start