This configuration assume you do have Nginx Proxy Manager, if you are using other proxy it might work too.
I will be setting things up using debian12 lxc.
Initial comands
apt update
apt dist-upgrade -y
apt install nano wget curl htop git composer mariadb-server nginx php-fpm php-curl php-pdo php-dom php-mysql php8.2-gd
sudo mysql
Mysql commands to create req db
create database req;
grant all on req.* to rep@localhost identified by 'req';
flush privilegs;
exit
Getting git and deploy keys - read in google ( git deploy ssh keys)
apt install git
ssh-keygen -t ecdsa
...enter...enter...
cd ~
cat .ssh/id_ecdsa.pub <- Copy the strig / paste on git website
Now part where you configure the server and laravel project.
Refer to any laravel deployment or try my other post.
Some special things that need to be done after downloading repo is that you do need add rights as www-data:www-data user as without this it will not fully work.
Assume we will be cloning our project to /opt/
Clone and setup project
cd /opt
git clone your_repository@github_using_SSH
cd project
composer install
cp .env.example .env
nano .env <- Setup mysql database parameters
npm install
npm run build
cd ..
chown -R www-data:www-data project
Configuration of nginx
nano /etc/php/8.2/fpm/php.ini
<- find line about max upload and increase to your likings
# Additional custom config IF its not overloaded by php.ini
nano /etc/php/8.2/cli/conf.d/99-custom.ini
Note if any of those values are in php.ini they will be overwrite, as i was trying to sort out why i cant upload larger file even with custom ini..
99-custom.ini
upload_max_filesize = 500M
post_max_size = 520M
max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
Nginx modify serving settings
cd /etc/nginx/sites-enabled
rm default
nano /etc/nginx/sites-enabled/project
Project file
server {
listen 80;
server_name website_using_ssl.com;
root /opt/R4/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
client_max_body_size 520M;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
large_client_header_buffers 4 16k;
# Optional: if using FastCGI (e.g. PHP-FPM)
fastcgi_buffer_size 32k;
fastcgi_buffers 16 16k;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# ^|^e Tell PHP-FPM we're using HTTPS
fastcgi_param HTTPS on;
fastcgi_param HTTP_X_FORWARDED_PROTO https;
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
fastcgi_param HTTP_HOST $host;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Almost there
systemctl restart php8.2-fpm
systemctl reload nginx
And last step will be to configure nginx proxy to point to this lxc instance of the server.
Setup redirect and check ssl, for that i did not made tutorial yet. But i bet you could find anything online on this topic just search “nginx proxy manager with cloudflare ddns challenge”.
