This guide provides instructions for deploying SIMPEG Lapas to a production environment.
- A web server (Nginx or Apache)
- PHP >= 8.2 with required extensions (bcmath, ctype, fileinfo, json, mbstring, openssl, pdo, tokenizer, xml)
- MySQL, MariaDB, or PostgreSQL
- Composer
- Node.js & NPM
server {
listen 80;
server_name simpeg.example.com;
root /var/www/simpeg-lapas/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index 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/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}Clone the repository or upload your code to the server.
git clone https://github.com/aryadians/simpeg-lapas.git /var/www/simpeg-lapas
cd /var/www/simpeg-lapasRun composer and npm to install production dependencies.
composer install --no-dev --optimize-autoloader
npm install
npm run buildCopy the .env.example to .env and configure it.
cp .env.example .env
nano .envCrucial Production Settings:
APP_ENV=productionAPP_DEBUG=falseAPP_URL=https://simpeg.example.comDB_DATABASE=...DB_USERNAME=...DB_PASSWORD=...
Generate the application key:
php artisan key:generate --forceEnsure the storage and bootstrap/cache directories are writable by the web server.
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cacheRun the database migrations for the production environment.
php artisan migrate --forceLaravel provides several commands to cache your configuration and routes for better performance.
php artisan config:cache
php artisan route:cache
php artisan view:cacheCreate the symbolic link for storage.
php artisan storage:linkWhen updating the application, it's recommended to use maintenance mode:
php artisan down
git pull origin main
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
npm install
npm run build
php artisan upCheck the logs in storage/logs/laravel.log for any issues.