This is setup for a laravel php website, but mostly the import is same, just few steps less / more.
Let's go through the whole setup process step by step:
1. Clone the repo (the dot is to clone into existing without creating parent folder):
cd /var/www/domain.com git clone git@github.com:yourusername/yourrepo.git .
2. Install PHP dependencies:
apt install php8.3-xml php8.3-mysql -y
3. Other basic dependencies:
composer install npm install npm run build
4. Fill in the .env
cp .env.example .env nano .env
5. Setup the core things up:
APP_URL=https://domain.com DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=db DB_USERNAME=user DB_PASSWORD=pass
6. Generate app key:
php artisan key:generate
7. Now setup the db:
mysql -u root CREATE DATABASE db; CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass'; GRANT ALLPRIVILEGES ON user.* TO 'db'@'localhost'; FLUSH PRIVILEGES; EXIT;
If you have some db sql export, which you would like unzip here (in this case, the right side of the command, is the place from which we are "importing")
mysql -u root db < /root/dump.sql
8. Storage link
php artisan storage:link chown -R www-data:www-data /var/www/domain.com/storage chown -R www-data:www-data /var/www/domain.com/bootstrap/cache chmod -R 775 /var/www/domain.com/storage
9. Nginx vhost
nano /etc/nginx/sites-available/domain.com
server {
listen 80;
server_name domain.com;
root /var/www/domain.com/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}ln -s /etc/nginx/sites-available/domain.com /etc/nginx/sites-enabled/ nginx -t systemctl reload nginx
10. Domain (after the right IP was set up in the A records)
certbot --nginx -d domain.com
And, for some reason, the uploads in cms did not have the right permissions:
chown -R www-data:www-data /var/www/symonround.com/storage chmod -R 775 /var/www/symonround.com/storage