Instructions for installing a Laravel/Symfony website script for Ubuntu 20-24
We execute the commands:
apt-get update
apt-get install software-properties-common
add-apt-repository -y ppa:ondrej/php
apt-get update
apt-get -y install unzip zip nginx curl php7.4 php7.4-mysql php7.4-fpm php7.4-mbstring php7.4-xml php7.4-curl redis-server mysql-client mysql-server
Install MYSQL:
sudo mysql_secure_installation
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR PASSWORD';
FLUSH PRIVILEGES;
quit
Let's install Node and PM2:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm)"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 16
nvm use 16
npm i -g pm2
Install phpMyAdmin
cd /usr/share
composer create-project phpmyadmin/phpmyadmin --repository-url=https://www.phpmyadmin.net/packages.json --no-dev
ln -s /usr/share/phpmyadmin /var/www/html/public
Configure the NGINX config
nano /etc/nginx/sites-available/default
Paste everything below. Be sure to specify your domain (already associated with the server).
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;
server {
listen 80;
listen [::]:80 ipv6only=on;
limit_conn perip 10;
limit_conn perserver 100;
# Log files for Debugging
access_log /var/log/nginx/laravel-access.log;
error_log /var/log/nginx/laravel-error.log;
# Webroot Directory for Laravel project
root /var/www/html/public;
index index.php index.html index.htm;
# Your Domain Name
server_name domain.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# PHP-FPM Configuration Nginx
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
END!!! Next, save using nano (in the terminal). If this doesn't work, simply download the file, update it, save it, and upload it back to the server.
Required:
service nginx restart
The basic installation is complete. If you need SSL,
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python3-certbot-nginx
sudo certbot --nginx
Run the bot (if using roulette, usually in /var/www/html/storage/bot or /var/www/html/server)
In the bot, don't forget to specify the paths to the certificates, which are located here - /etc/letsencrypt/live/
pm2 start app.js

Spain
Portugal

