web server install instructions added.

main
Robert 2 years ago
parent 17ef1fe7cc
commit 5de3fbb34e
  1. 79
      protected/README.MD

@ -1,4 +1,4 @@
# cms
# cms - Content Management System
Original Author: Matt Doyle <https://www.elated.com/cms-in-an-afternoon-php-mysql/>
@ -37,6 +37,8 @@ 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
@ -63,6 +65,81 @@ $ pwd
$ 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:

Loading…
Cancel
Save