Installation - Sageth/phparcade GitHub Wiki

Installation

  1. Clone the repository by going to the folder above where you want to install. So, if you want to set up the site in /var/www/phpArcade, you would go to /var/www and type:
$ git clone https://[email protected]/sageth/phparcade.git

or

$ git clone https://[email protected]/Sageth/phparcade.git
  1. Read usercfg.php and follow the instructions. Save the file.
  2. Change permissions. Depending on your setup, this will be different, however, assuming you installed in /var/www/ you would do something like:
$ chown -R www:www /var/www/phpArcade   #Changes owner of files
$ find /var/www/phpArcade -type d -print0 | xargs -0 chmod 755 #Changes directories to 755
$ find /var/www/phpArcade -type f -print0 | xargs -0 chmod 644 #Changes files to 644
  1. Next you must install the dependencies. The easiest way is with composer. Assuming you already have composer installed on your system, you just need to run:
$ composer install --no-dev

Example Site Configuration

Please note that phpArcade.ini is case-sensitive and must be readable by your web user Below is what a phpArcade.ini config file will look like. It should be at the same level you cloned from (e.g. if your site is in /www/phparcade/, then your config file would be one level up at /www/phpArcade.ini).

[environment]
; Values are either "prod" or "dev"
state = "prod"

[database]
driver = "mysql"
host = "localhost"
port = "3306"
pass = "dbpassword"
schema = "dbschema"
user = "dbuser"

[mail]
;used for sending emails via gmail
gmailpassword = "gmailpassword"

[aes]
;future feature
aeskey = "randomcharacters"

[webhooks]
;used for notifications in high scores to Discord or other service that has webhooks
;dev url is used for local testing
highscoreURI = "<WEBHOOK URI>"
highscoreURI_Dev = "<DEV_WEBHOOK_URI>"

Example nginX Site Configuration

server {
  listen	80;
  server_name   example.com;

  #Redirects http://example.com to http://www.example.com
  rewrite ^/(.*) http://www.example.com/$1 permanent;
}
server {
    server_name www.example.com;
    access_log  /var/www/logs/example.com/access.log main;
    error_log  	/var/www/logs/example.com/error.log debug;
    root        /var/www/example.com/;
    index       index.php;
    listen      80;

    ####### DENYS ######
    ###### DON'T ALLOW UNCOMMON REQUEST METHODS #####
    if ($request_method !~ ^(GET|HEAD|POST)$ ) {return 444;}

    ##### ALLOWS #####
    # Removes trailing slashes (prevents SEO duplicate content issues)
    if (!-d $request_filename) {rewrite ^/(.+)/$ /$1 permanent;}

    location / {
        limit_except GET POST {deny all;}
        try_files $uri $uri/ @phparcade;
    }

    ##### IF YOU'RE A PHP FILE, PROCESS IT #####
    location ~ [^/]\.php(/|$) {
        limit_except GET POST {deny all;}
        include /etc/nginx/conf.d/fastcgi.conf;
        try_files $uri $uri/ /index.php =404;
        location ~ \..*/.*\.php$ {return 404;}
        fastcgi_pass   unix:/var/run/php-fcgi.pid;
    }

    location @phparcade {
        limit_except GET POST {deny all;}
        #Rewrite the games
        rewrite ^/game/(.*)/(.*)\.php$ /index.php?act=Arcade&do=newscore last;
        rewrite ^/game/([0-9]+)/arcade/gamedata/(.*)$ /arcade/gamedata/$2 last;
        rewrite ^/(.*).html$ /index.php?params=$1 last;
        rewrite ^/robots.txt$ /robots.php last;
    }
}

Logging in

The default username and password are admin/admin. You should change this as soon as possible.