- VPS Provider: Hostinger
- Server Type: Ubuntu 24.04
- SSH client (Terminal for Linux/Mac, PowerShell/CMD for Windows)
- Open terminal/command prompt
- Connect to the server using SSH:
ssh root@<server-ip> -p <ssh-port>
- Enter the SSH password when prompted
- Update system packages:
sudo apt update
sudo apt upgrade -y
- Install node & npm:
sudo apt install nodejs npm -y
node -v
npm -v
- Clone repository
git clone https://github.com/thecodedose/pastanation.git
- Install dependencies
cd pastanation
npm install
- Build project
npm run build
- Move your Phaser game build files to the web directory:
sudo cp -r dist/* /var/www/html/
- Ensure the files have the right permissions:
sudo chmod -R 755 /var/www/html
sudo chown -R www-data:www-data /var/www/html
Once logged in, run these commands to set up the server:
- Update system packages:
sudo apt update
sudo apt upgrade -y
- Install Nginx:
sudo apt install nginx -y
- Check if Nginx is running:
systemctl status nginx
If it’s not running, start it:
sudo systemctl start nginx
- Enable it to start on boot:
sudo systemctl enable nginx
- Access your game:
- Open web browser
- Visit your server IP address
-
Purchase a domain name
-
Add DNS records:
- Type: A Record
- Points to: 147.93.97.173
- TTL: 3600
-
Update Nginx configuration:
nano /etc/nginx/sites-available/phaser-game
- Modify server_name:
server_name your-domain.com www.your-domain.com 147.93.97.173;
- Restart Nginx:
nginx -t
systemctl restart nginx
- Check Nginx error logs:
cat /var/log/nginx/error.log
- Check Nginx access logs:
cat /var/log/nginx/access.log
- Verify file permissions:
ls -la /var/www/phaser-game
- Keep your SSH password secure
- Regularly update system packages
- Consider setting up SSL/HTTPS for production
- Backup your game files regularly
- To update game files:
cd pastanation/dist
npm run build
sudo cp -r dist/* /var/www/html/
- To restart Nginx after changes:
systemctl restart nginx