A simple Content Management System.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
cms/protected
Robert 5de3fbb34e web server install instructions added. 2 years ago
..
src init 2 years ago
README.MD web server install instructions added. 2 years ago
composer.json init 2 years ago

README.MD

cms - Content Management System

Original Author: Matt Doyle https://www.elated.com/cms-in-an-afternoon-php-mysql/

Updates: Robert S.

Pull repo

$ cd /var/www
$ git clone https://git.mysnippetsofcode.com/bobs/cms
$ cd cms

SETUP from MySQL Root run:

# Install the server:
$ sudo apt-get install mysql-server
$ sudo systemctl start mysql
$ sudo systemctl enable mysql

# Change this password SJ6G*WyaV7PvvEts@vxjm used below! 
$ mysql -u root -p
> CREATE USER 'zoombox'@'localhost' IDENTIFIED BY 'SJ6G*WyaV7PvvEts@vxjm';
> GRANT ALL ON cms.* TO 'zoombox'@'localhost';
> create database cms;

Import the tables.sql file:

$ mysql -u cms -p cms < tables.sql
    enter this password when prompted: SJ6G*WyaV7PvvEts@vxjm

The config.php file is in the protected/src folder.

define( "BLOG_NAME", "Widgetz Newz" ); // Display Name for Titles

Create the .env file in root of Project to configure your secrets!

$ pwd
# You should be in /var/www/cms
$ nano .env
DB_TYPE=mysql
DB_HOST=127.0.0.1
DB_NAME=cms
DB_USERNAME=zoombox
DB_PASSWORD=SJ6G*WyaV7PvvEts@vxjm
ADMIN_USERS=zug:SunSet@XQWET,zig:546Poker@xzyWhy

Note: the admin username is: zug

Admin password is: SunSet@XQWET

Install Composer

$ curl -sS https://getcomposer.org/installer | php

Install Composer deps

$ cd protected
$ pwd
# You should be in /var/www/cms/protected
$ composer install

Install web server apache2 or nginx

Pick one

# for Apache2
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-php8.3
# edit default site:
$ sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/cms/public

    <Directory /var/www/cms/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ sudo a2ensite 000-default.conf
$ sudo a2enmod rewrite
# after php deps are installed come back and run this:
$ sudo a2enmod php8.3
# Install Certbot to get SSL certs for Apache2
$ sudo apt-get update
$ sudo apt-get install certbot
$ sudo certbot --apache
$ sudo systemctl restart apache2

-----------------------------------------------------------

# for nginx
$ sudo apt-get install nginx
$ sudo apt-get install php8.3-fpm
# Configure nginx for cms
$ sudo nano /etc/nginx/sites-available/cms
# Replace your_domain.com with your actual domain or IP address:
server {
    listen 80;
    server_name your_domain.com;
    root /var/www/cms/public;

    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;  # Adjust the PHP version if necessary
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

$ sudo ln -s /etc/nginx/sites-available/cms /etc/nginx/sites-enabled/
$ sudo nginx -t
# if test is ok, then run:
$ sudo systemctl reload nginx
# Install Certbot to get SSL certs for nginx
$ sudo apt-get update
$ sudo apt-get install certbot
$ sudo certbot --nginx
$ sudo systemctl reload nginx

PHP deps

PHP gd and mysql must be installed:
$ sudo apt-get install php8.3 php8.3-gd php8.3-mysql