Web application vanilla template.
Create a new copy of this project via composer
$ composer create-project caffeina-core/base-application ./my-awesome-new-app
$ cd my-awesome-new-app
$ composer dump-autoload -o
Done.
A complete PHP+NginX server is ready from
docker pull caffeina/core-app
Like all URL-routed web app, you need to pass every request to the front controller public/index.php
.
Change PATH_TO_YOUR_APP_DIR
to the absolute path of your project directory.
server {
listen 80 default_server;
root PATH_TO_YOUR_APP_DIR/public/;
index index.php index.html index.htm;
location / {
try_files $uri /index.php$is_args$args;
}
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Assert that the document root of the virtualhost is pointing to PATH_TO_YOUR_APP_DIR/public/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>