Skip to content

Latest commit

 

History

History
181 lines (121 loc) · 2.45 KB

DEPLOYMENT.md

File metadata and controls

181 lines (121 loc) · 2.45 KB

Phaser Game Deployment Guide

Server Details

  • VPS Provider: Hostinger
  • Server Type: Ubuntu 24.04

Prerequisites

  • SSH client (Terminal for Linux/Mac, PowerShell/CMD for Windows)

Step 1: Server Access

  1. Open terminal/command prompt
  2. Connect to the server using SSH:
ssh root@<server-ip> -p <ssh-port>
  1. Enter the SSH password when prompted

Step 2: Build Game

  1. Update system packages:
sudo apt update
sudo apt upgrade -y
  1. Install node & npm:
sudo apt install nodejs npm -y
node -v
npm -v
  1. Clone repository
git clone https://github.com/thecodedose/pastanation.git
  1. Install dependencies
cd pastanation
npm install
  1. Build project
npm run build
  1. Move your Phaser game build files to the web directory:
sudo cp -r dist/* /var/www/html/
  1. Ensure the files have the right permissions:
sudo chmod -R 755 /var/www/html
sudo chown -R www-data:www-data /var/www/html

Step 3: Server Setup

Once logged in, run these commands to set up the server:

  1. Update system packages:
sudo apt update
sudo apt upgrade -y
  1. Install Nginx:
sudo apt install nginx -y
  1. Check if Nginx is running:
systemctl status nginx

If it’s not running, start it:

sudo systemctl start nginx
  1. Enable it to start on boot:
sudo systemctl enable nginx
  1. Access your game:
  • Open web browser
  • Visit your server IP address

Adding a Domain Name (Optional)

  1. Purchase a domain name

  2. Add DNS records:

    • Type: A Record
    • Points to: 147.93.97.173
    • TTL: 3600
  3. Update Nginx configuration:

nano /etc/nginx/sites-available/phaser-game
  1. Modify server_name:
server_name your-domain.com www.your-domain.com 147.93.97.173;
  1. Restart Nginx:
nginx -t
systemctl restart nginx

Troubleshooting

  1. Check Nginx error logs:
cat /var/log/nginx/error.log
  1. Check Nginx access logs:
cat /var/log/nginx/access.log
  1. Verify file permissions:
ls -la /var/www/phaser-game

Security Notes

  • Keep your SSH password secure
  • Regularly update system packages
  • Consider setting up SSL/HTTPS for production
  • Backup your game files regularly

Maintenance

  1. To update game files:
cd pastanation/dist
npm run build
sudo cp -r dist/* /var/www/html/
  1. To restart Nginx after changes:
systemctl restart nginx