Tous les articles

My (php) dev setup


Minimal setup

Every framework provide a minimal server by a command like :


# laravel
> php artisan serve

# craft
> php craft serve

Basic setup

Add a line in your hosts file :

# /etc/hosts
127.0.0.1	blog.test

setup your nginx :

# /etc/nginx/sites-available/all.conf

server {
	server_name blog.test;
	root /home/charly/web/blog.text/public;
	include snippets/php.conf;
}
# /etc/nginx/snippets/php.conf
index index.php index.html;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_pass unix:/run/php/php8.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

setup your php-fpm

# /etc/php/8.4/fpm/pool.d/www.conf

user = charly
group = charly

listen = /run/php/php8.4-fpm.sock

listen.owner = charly
listen.group = charly

... dev !