From bf77612b64631fd4fd6f964b05897eacc5723845 Mon Sep 17 00:00:00 2001 From: tanhongit Date: Thu, 7 Jul 2022 07:03:09 +0700 Subject: [PATCH] update readme --- README.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 261c294..596396a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# Welcome to PHP MVC Structure by TanHongIT +# Welcome to YL MVC Structure by TanHongIT + +**YL MVC Structure (PHP MVC)** is a pattern made in PHP used to implement user interfaces, data, and controlling logic. + +It's built based on the combination of ideas from the Yii framework and Laravel framework (yl). # 1. Configuration requirements @@ -23,11 +27,89 @@ npm run build # 4. Edit Connect Database -You need to change the connection information to the database after you have cloned my repository so that the website can work. +You need to change the connection information to the database if you want to store and use data for the website. + +Path: [`/config/database.php`](https://github.com/TanHongIT/yl-mvc-structure/tree/main/config) ```php define('DB_HOST', 'localhost'); define('DB_USER', 'root'); define('DB_PASS', ''); define('DB_NAME', 'chatapp-php'); +``` + +# 5. Install and using ssl certificate + +Using **mkcert** to create ssl certificate + +### On Ubuntu + +```shell +sudo apt install libnss3-tools + +sudo wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 && \ +sudo mv mkcert-v1.4.3-linux-amd64 mkcert && \ +sudo chmod +x mkcert && \ +sudo cp mkcert /usr/local/bin/ +``` + +Now that the mkcert utility is installed, run the command below to generate and install your local CA: + +```shell +mkcert -install +``` + +### Create ssl certificate for this project + +Run: + +```shell +cd /var/www/certs +mkcert local.yl_mvc_structure.com +``` + +### Update configuration + +Change **local.yl_mvc_structure.com.conf** file (/apache2/sites-available/ to this) + +``` + + ServerAdmin localserver@localhost + ServerName local.yl_mvc_structure.com + ServerAlias www.yl_mvc_structure.vdx.com + DocumentRoot /var/www/yl_mvc_structure + ErrorLog /var/www/logs/error-yl_mvc_structure.log + CustomLog /var/www/logs/access-yl_mvc_structure.log combined + + + + ServerAdmin localserver@localhost + ServerName local.yl_mvc_structure.com + ServerAlias www.local.yl_mvc_structure.com + DocumentRoot /var/www/yl_mvc_structure + + ErrorLog /var/www/logs/error-yl_mvc_structure.log + CustomLog /var/www/logs/access-yl_mvc_structure.log combined + + SSLEngine on + SSLCertificateFile /var/www/certs/local.yl_mvc_structure.com.pem + SSLCertificateKeyFile /var/www/certs/local.yl_mvc_structure.com-key.pem + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +``` + +When done, you can test the website by opening the browser and typing the following URL: + +```shell +https://local.yl_mvc_structure.com + +https://local.yl_mvc_structure.com/product +https://local.yl_mvc_structure.com/product/all +https://local.yl_mvc_structure.com/product/show/1 +... ``` \ No newline at end of file