Server configuration for PHP & Laravel projects.
Server configuration for PHP & Laravel projects.
md
Last active last week • Report abuse
SERVER-CONFIGURATION.md
This document outlines the guidelines for configuring a new VPS/Cloud server, specifically
focusing on Debian 12 (or Ubuntu 24.04 as an alternative). If using a different distribution,
commands may vary, and you will need to adjust accordingly.
1. Initial Setup
2. Sudo Configuration
su -
adduser admin
usermod -aG sudo admin
3. Setting Up a Firewall
/usr/share/ufw/check-requirements
reboot now
Enable UFW:
ufw enable
Note: You may be logged out after enabling UFW. Log back in to continue.
ufw status
logout
4. Installing PHP
Install PHP-FPM (FastCGI Process Manager) and necessary PHP extensions:
sudo apt install php-fpm php-mbstring php-xml php-bcmath php-curl php-gd php-mysql php-zip
php -v
php -m
5. Installing Nginx
To serve web applications, install Nginx:
Enable the "Nginx Full" profile, which allows both HTTP and HTTPS traffic:
• Restart Nginx:
sudo mysql_secure_installation
• Afterward, press Y and ENTER to accept the defaults for the remaining prompts. These steps
will remove anonymous users, disable remote root logins, and remove the test database,
securing your MariaDB setup.
sudo mariadb
Be sure to replace 'admin' and 'password' with your desired username and password.
sudo mariadb
2.
Create a new database named example_db with the utf8 character set and utf8_unicode_ci
collation:
4. Grant all privileges on the example_db database to the newly created user:
FLUSH PRIVILEGES;
exit;
Make sure to replace example_db , example_user , and example_pw with your desired database
name, username, and password.
cd /var/www/sub.example.com
git clone -b <branchname> <remote-repository-url>
composer install
Grant read, write, and execute permissions for storage and bootstrap/cache :
cp .env.example .env
php artisan key:generate
php artisan storage:link
php artisan migrate
@hi2tamzid updated