A simple blogging Web Application
- Docker
-
Build and start detached server container
docker-compose up --build -d
-
Go to url
http://localhost
-
PHP 8.0.2
-
Composer 2.3.4
-
MySQL 8
-
Nginx
Assuming you have installed Composer, MySQL, PHP, and Nginx in your system already. To deploy to nginx please follow the instructions below.
- Login to mysql and create new DB
sudo mysql
CREATE DATABASE "your database name";
- Create an new system user and grant privileges
CREATE USER '"your username"'@'%' IDENTIFIED WITH mysql_native_password BY 'your password';
- Set user permission for over DB
GRANT ALL ON "your database name".* TO '"your username"'@'%';
- Change directory to www folder
cd /var/www/
- Clone blog repository
git clone https://github.com/jacksonmoji/vetro-blog.git
- Change directory into vetro-blog
cd vetro-blog
-
Change Database Connection Name from
sqlite
tomysql
inconfig/database.php
-
Add new environment file
sudo nano .env
- Add your local settings in to the
.env
file
APP_NAME=vetro-blog
APP_ENV=production
APP_KEY="your generated application unique key"
APP_DEBUG=false
APP_URL=http://vetro_blog
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE="your database name"
DB_USERNAME="your username"
DB_PASSWORD="your password"
- Run migration into new mysql database
php artisan migrate
- Run these commands in your terminal
sudo chown -R www-data.www-data /var/www/vetro-blog/storage
sudo chown -R www-data.www-data /var/www/vetro-blog/bootstrap/cache
- Create a new virtual host configuration
sudo nano /etc/nginx/sites-available/vetro-blog
- Copy this configuration content into the open configuration file
server {
listen 80;
server_name vetro_blog;
root /var/www/vetro-blog/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
- Create a symbolic link to
vetro-blog
insites-enabled
in order to activate the new virtual host configuration file
sudo ln -s /etc/nginx/sites-available/vetro-blog /etc/nginx/sites-enabled/
- Reload Nginx server to apply changes
sudo systemctl reload nginx
- Visit site at
http://vetro_blog