panique / mini

Just an extremely simple naked PHP application, useful for small projects and quick prototypes. Some might call it a micro framework :)
1.35k stars 478 forks source link

moving mini from Apache to Nginx #255

Open rjCousineau opened 2 years ago

rjCousineau commented 2 years ago

I migrated from Apache to Nginx, and found the provided nginx config example only worked after changing the root from / to /public.

This config worked as well:

server {
        server_name servername.devops.local;
        listen [::]:80;
        listen 80;

        access_log /var/log/nginx/servername.devops.local.log;
        error_log /var/log/nginx/servername.devops.local.log;

        root /var/www/servername/public_html;

        location / {
                index index.php;
                try_files /public/$uri /public/$uri/ /public/index.php?url=$uri;
        }

        location ~ \.php$ {
                fastcgi_pass unix:/run/php-fpm/www.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}
AlmaLinux 8.6 (Sky Tiger) Linux 4.18.0-372.16.1.el8_6.x86_64
nginx version: nginx/1.14.1
PHP 8.1.8

I'm posting this as an extension to conversation https://github.com/panique/mini/issues/55