This is a PHP application to run a website that will let you rent video games out.
- Install the PHP7.2 and webmin repos
sudo add-apt-repository -y ppa:ondrej/php && sudo apt-get update
- Install Apache, PHP and mySQL
sudo apt-get install -y apache2sudo apt-get install -y php7.2 zip unzip php7.2-curl php7.2-mbstring php7.2-dom php7.2-gd php7.2-mysql php7.2-zip composer mariadb-server
- Secure the MariaDB installation
sudo /usr/bin/mysql_secure_installation- I strongly recommend you reset the MariaDB root password, disable root login remotely, remove anonymous users and the test DB, and reload priviliges. (i.e. yes to all answers)
- Setup the apache folders.
sudo nano /etc/apache2/apache2.conf- Find the section that says <Directory /var/www> and change "AllowOverride None" to "AllowOverride All"
sudo nano /etc/apache2/sites-available/000-default.conf- Find the line that says "DocumentRoot" and make sure it says "DocumentRoot /var/www/html/andach-gamerental/public"
sudo a2enmod rewritesudo service apache2 restart
mysql -u root -p(enter the password as needed)CREATE DATABASE gamerental;CREATE USER gamerental;GRANT ALL on gamerental.* to 'gamerental';SET PASSWORD for 'gamerental' = PASSWORD('XXXXXX');EXIT;- You should now be back to the normal BASH shell.
cd /var/www/htmlsudo rm index.htmlchown www-data:www-data /var/www/htmlsudo -u www-data git clone https://github.com/useaquestion/andach-gamerental
cd /var/www/html/andach-gamerentalcomposer install --no-dev(omit the --no-dev flag if you're setting up a dev environment of course)php artisan key:generate(and at this point set up the SQL password appropriately)php artisan migrate:refresh --seed.php artisan storage:linksudo service apache2 restart
- Enable SSL for apache.
sudo a2enmod sslsudo a2ensite default-ssl.confsudo nano /etc/apache2/sites-available/default-ssl.confand change the DocumentRoot parameter accordingly.sudo service apache2 restart- Clone Let's Encrypt information into your /usr/local directory
cd /usr/local sudo git clone https://github.com/letsencrypt/letsencrypt cd /usr/local/letsencrypt sudo ./letsencrypt-auto --apache -d andachgames.co.uk - This takes some time to load. Enter your email address, agree to the terms of service and set the entire website to force HTTPS.
- Then setup the crontab
sudo crontab -eand add the below line: 0 1 1 */2 * cd /usr/local/letsencrypt && ./letsencrypt-auto certonly --apache --renew-by-default --apache -d andachrental.co.uk >> /var/log/andachrental.co.uk-renew.log 2>&1
sudo a2enmod expiressudo nano /etc/apache2/sites-available/default-ssl.conffile and paste this at the bottom:
<IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 30 seconds" ExpiresByType text/html "access plus 15 days" ExpiresByType image/gif "access plus 1 months" ExpiresByType image/jpg "access plus 1 months" ExpiresByType image/jpeg "access plus 1 months" ExpiresByType image/png "access plus 1 months" ExpiresByType text/js "access plus 1 months" ExpiresByType text/javascript "access plus 1 months" </IfModule>
4. Remove the server signatures by pasting the below into the bottom of /etc/apache2/apache2.conf
ServerSignature Off ServerTokens Prod