Server Setup Gist:
- 
Open Server: - Access the server environment.
 
- 
Navigate to Root Directory: - Use the command: cd /var/www/html/to reach the root directory.
 
- Use the command: 
- 
Clean Previous Files (Optional): - Delete any existing files in the directory with sudo rm -rf /var/www/html/*(Optional but recommended).
 
- Delete any existing files in the directory with 
- 
Clone Repository: - Execute git clone [url] .to clone the repository.
 
- Execute 
- 
Install Composer: - Run sudo apt composer installto install Composer.
- Execute composer installafterwards.
 
- Run 
- 
Set Permissions: - Set permissions using the following commands [Mandatory]:
sudo chmod -R 775 /var/www/html sudo chown -R $USER:www-data /var/www/html sudo chgrp -R www-data storage bootstrap/cache sudo chmod -R ug+rwx storage bootstrap/cache sudo chmod 0440 .env
 
- Set permissions using the following commands [Mandatory]:
- 
Create .env File: - Run sudo nano .envto create and edit the environment file.
- Add database credentials to the file.
 
- Run 
- 
Configure Apache: - Navigate to /etc/apache2/sites-enabled.cd /etc/apache2/sites-enabled
- Open default-ssl.conf, with sudosudo vi default-ssl.conf
- if we don't have default-ssl.confthen opensudo vi 000-default.conf
- Set the following configuration:
DocumentRoot /var/www/html/public <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
 
- Navigate to 
- 
Restart Apache: - Grant required permissions and restart Apache with sudo service apache2 restart.
 
- Grant required permissions and restart Apache with 
- 
Run Artisan Commands: - Execute sudo -u www-data php artisan migrateand
- sudo -u www-data php artisan passport:install.
 
- Execute 
- 
Setup Complete: - The server is now set up and ready to use.