-
Notifications
You must be signed in to change notification settings - Fork 109
Installation
Good-Old-Downloads edited this page Jan 2, 2019
·
8 revisions
We will be using Ubuntu 16.04.5 LTS and PHP 7.3 for this tutorial.
- PHP and required modules
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.3 php7.3-curl php7.3-gd php7.3-pdo
-
MariaDB
Follow the instructions here and install the latest stable MariaDB
https://downloads.mariadb.org/mariadb/repositories/ -
memcached
apt-get install memcached
- Composer https://getcomposer.org/download/
-
A web server (pick one)
- Nginx
apt-get install nginx
- Apache
apt-get install apache2
- Nginx
Clone the site into where you want the code to be.
cd /var/www/
git clone https://github.com/Good-Old-Downloads/gg.git
The code should now be in /var/www/gg
. Change the directory and install the dependencies using composer.
cd gg
composer install
Make a copy of config_blank.php
and name it config.php
cp config_blank.php config.php
Edit config.php
Config explanation:
<?php
$CONFIG = [
// The login URL, set up a script to change this once in a while if you're paranoid.
"LOGIN_PATH" => 'ayylmaosecretloginpageyolo',
"BASEDIR" => "/var/www/gg",
// Storage paths for GOG iamges
"BG_STORAGE" => "/var/www/gg/static/img/games/bg",
"DETAILS_STORAGE" => "/var/www/god/static/img/games/details",
"THUMB_STORAGE" => "/var/www/god/static/img/games/thumb",
// Shows PHP errors, disables the Twig cache, probably does other things.
// Set to false in production.
"DEV" => true,
// GG has no user system. Set up the login name and password here.
// Again, use a script to change this once in a while if you're paranoid.
"USER" => [
"NAME" => "supasecretlogin",
"PASS" => "123",
// Key used with the http API
"KEY" => "123-321-1337"
],
// MySQL details
"DB" => [
"DBNAME" => "gg",
"DBUSER" => "root",
"DBPASS" => ""
],
// Memcached details
"MEMCACHED" => [
"SERVER" => "127.0.0.1",
"PORT" => 11211
]
];
// Keys for the Vigenère cipher. Make a lot of these.
// Shitty way to stop the most basic of HTML scrapers, if someone takes time to put the smallest amount of effort to decypher this, then they deserve the links. (pretty sure someone from The Eye already made a dumper)
$VKEYS = [
"RANDKEYONE",
"RANDKEYTWO",
"RANDKEYTHREE",
"RANDKEYFOUR",
"RANDKEYFIVE",
"RANDKEYSIX",
"RANDKESVEN"
];
gg can be used with either Nginx or Apache.
Make a new file: /etc/nginx/sites-available/gg
and copy paste the following:
server {
listen 443 ssl http2;
server_name example.com;
root /var/www/gg/web; # <-- must point to /web directory
index index.php
autoindex on;
location = /index.php {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
return 404;
}
location ~ /\.ht {
deny all;
}
}
Symlink the new config file to /etc/nginx/sites-enabled/gg
ln -sf /etc/nginx/sites-available/gg /etc/nginx/sites-enabled/gg
Check config syntax.
nginx -t
If no errors were found, tell nginx to reload.
nginx -s reload
Install the PHP Apache2 module.
apt install libapache2-mod-php
Enable the module.
a2enmod php7.3
Make a new vhost config /etc/apache2/sites-available/gg.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/gg/web
ErrorLog ${APACHE_LOG_DIR}/error_gg.log
CustomLog ${APACHE_LOG_DIR}/access_gg.log combined
</VirtualHost>
Enable the New vhost
a2ensite gg.conf
Restart the apache2 service
service apache2 restart
mysql -u root -p < /var/www/gg/db.sql