Luminova Framework

PHP Luminova: Installation and Setup

Last updated: 2026-11-28 20:57:12

Guides for installing and configuring the Luminova framework, setting up a local PHP development server, and configuring web servers to route incoming requests through the application's public entry point.

For a new Luminova project, use composer create-project to create the project, install its PHP dependencies, and generate an application key as part of setup. If you clone the Git repository or download the project as a ZIP archive, run composer install and php novakit generate:key from the project directory.

Once the project is set up, run php novakit server to open it locally. If you use Apache or Nginx, point the document root at the project's public/ directory so the web server can serve public files directly and route application requests through public/index.php.


Composer Installation

Installing via Composer is recommended to keeps Framework up to date easily.

composer create-project luminovang/luminova my-project

Install in Current Directory:

To install into an empty current directory, give Composer . as the destination.

composer create-project luminovang/luminova .

Git Installation

Installing via git command.

git clone https://github.com/luminovang/luminova.git my-project
cd my-project
composer install
php novakit generate:key

Manual Download

To manually download and install the Luminova framework, follow these steps:

  1. Choose your version on the Luminova releases page and download the ZIP file.
  2. Extract the ZIP file to your project directory.
  3. Run composer install in the project directory to install dependencies, then run php novakit generate:key for a new application.
  4. Run php novakit server for local development, or configure a local server to serve the project’s public/ directory.
  5. Open the address shown by Novakit or the configured local virtual host.

Composer installs the framework and boot dependencies declared by the scaffold. Set app.hostname and app.name in .env for your environment.


Web Server Configurations

Let's start by creating your first website with the Luminova framework.

The first step is to configure your web server to use the framework's public directory as its document root. This ensures that only the application's entry point and browser-accessible resources are exposed to the web.

For example, your project should use the following directory as its document root:

/path/to/your/project/public

Understanding the Document Root

Assuming your existing web server document root uses one of the following directory structures:

  • /var/www/html
  • /var/www/public_html
  • /path/to/public_html

You need to update the document root to point to the project's public directory. This may involve creating a new project directory and configuring the necessary ownership and permissions.

For example, your new project structure could use any of the following paths:

  • /var/www/public
  • /var/www/my-project/public
  • /var/www/public_html/public
  • /path/to/public_html/public

Project and Public Directories

The original document root directory (www, my-project, or public_html) becomes the private project root, where your application source code, framework files, configurations, and other internal resources reside, including .env file.

The nested public directory becomes the web-accessible document root. It contains the Luminova entry controller (index.php) and public assets that browsers need to access.

Important:

Never point your web server directly to the project root.Always use the public directory as the document root to preventexposing application source files and other private resources.


Virtual Host Configuration Examples

Configure your web server to serve the Luminova application from its public directory. The following examples provide basic virtual host configurations for Apache and Nginx. Adjust the paths, domain names, PHP settings, and socket locations to match your server environment.

Apache Virtual Host

Create or update your Apache virtual host configuration with the following settings:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot "/var/www/example.com/public"

    # Logs inside writeable/log
    ErrorLog  "/var/www/example.com/writeable/log/server/error_log"
    CustomLog "/var/www/example.com/writeable/log/server/access_log" combined

    <Directory "/var/www/example.com/public">
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    # Optional: Set custom php.ini path (if mod_php is used)
    <IfModule mod_php.c>
        SetEnv PHPRC /var/www/example.com/php.ini
    </IfModule>
</VirtualHost>

Nginx Virtual Host

Create or update your Nginx server block with the following settings:

server {
    listen 80;
    server_name example.com www.example.com;

    root /var/www/example.com/public;
    index index.php;

    access_log /var/www/example.com/access_log;
    error_log  /var/www/example.com/error_log;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/luminova-fpm.sock; # Use your PHP-FPM pool socket.

        # Optional: security headers for PHP
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    # Block access to .ht* and hidden files
    location ~ /\.ht {
        deny all;
    }
}

Important:

These are starting configurations, not universal server settings.Ensure that the PHP-FPM socket matches your installedPHP version and pool configuration.For production deployments, also configure HTTPS and verify that the webserver has the required permissions to access the public directory and write to the application's designated log directory.


Htaccess Configuration

Place the .htaccess file in your project's public/ directory to configure Apache URL rewriting, directory access, and request forwarding.

These rules help secure public resources, normalize URLs, preserve authorization headers, and route application requests through Luminova's front controller (index.php).

Directory Listing Protection

Disable automatic directory listings to prevent visitors from browsing directory contents when no index file is available.

# /public/.htaccess

<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

Directory Index and URL Rewriting

Enable Apache's rewrite engine and set index.php as the default entry point when accessing a directory without an explicitly requested index file.

# /public/.htaccess

RewriteEngine On
DirectoryIndex index.php

Authorization Header Preservation

Preserve the HTTP Authorization header by exposing it as an environment variable. This is useful for API authentication mechanisms that rely on bearer tokens or other authorization schemes.

# /public/.htaccess

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

URL Normalization

Remove trailing slashes from URLs that do not resolve to actual directories. Exclude /assets and /.well-known paths from this rule to avoid modifying static resource and well-known endpoint URLs.

# /public/.htaccess

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(assets|\.well-known)/
RewriteCond %{REQUEST_URI} ^(.+?)/+$
RewriteRule ^ %{REQUEST_SCHEME}://%{HTTP_HOST}%1 [R=301,L,NE]

Front Controller Routing

Forward requests to Luminova's front controller (index.php) when the requested resource does not correspond to an existing file or directory.

Existing files and directories, including static assets and .well-known resources, are served directly without passing through the application router.

# /public/.htaccess

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

HTTPS Enforcement

Recommended for production

Redirect all HTTP requests to HTTPS to ensure that communication between clients and the server is encrypted.

# /public/.htaccess

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Note:

Ensure that your domain has a valid SSL/TLS certificate and HTTPS is properly configured before enabling this redirect.For reverse proxy deployments, use a trusted proxy-aware HTTPS detection rule instead of relying on SERVER_PORT.

Apache Server Signature

Recommended for production

Disable Apache's server signature to prevent error pages and server-generated responses from exposing additional server information.

# /public/.htaccess

ServerSignature Off

Note:

ServerSignature Off hides the server signature on Apache-generated pages but does not remove the Server HTTP response header.Use ServerTokens Prod in the main Apache configuration to limit the information exposed through that header.


Complete Default Htaccess Configuration

The following example combines all the recommended Apache configuration rules into a single /public/.htaccess file. It includes directory listing protection, URL rewriting, HTTPS enforcement, authorization header preservation, URL normalization, and front controller routing.

Use this as a starting configuration for your Luminova application and adjust it to match your server environment.

# /public/.htaccess

# Directory Listing Protection
<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

# Apache Server Signature
ServerSignature Off

<IfModule mod_rewrite.c>
    # Enable URL Rewriting
    RewriteEngine On

    # Default Directory Index
    DirectoryIndex index.php

    # Enforce HTTPS
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Authorization Header Preservation
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # URL Normalization
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(assets|\.well-known)/
    RewriteCond %{REQUEST_URI} ^(.+?)/+$
    RewriteRule ^ %{REQUEST_SCHEME}://%{HTTP_HOST}%1 [R=301,L,NE]

    # Front Controller Routing
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Production considerations:

Ensure Apache's mod_rewrite module is enabled and the virtual host allows .htaccess overrides through AllowOverride All.


Project Directory Structure

The following directory tree illustrates a typical Luminova project layout, based on the Apache and Nginx configurations described above. It shows the separation between application source code, framework files, public resources, and runtime storage.

/var/www/
└── example.com/                         (Project root)
    ├── .env                             (Environment variable configurations)
    ├── novakit                          (Novakit executable file)
    ├── app/                             (Application source code and modules)
    │   ├── Config/                      (Application configuration classes)
    │   ├── Console/                     (Custom Novakit CLI console classes)
    │   ├── Database/                    (Database migrations and seeders)
    │   ├── Models/                      (Application-wide MVC models)
    │   ├── Languages/                   (Localization files)
    │   ├── Utils/                       (Custom classes and global functions)
    │   ├── Errors/                      (Application error handling)
    │   │   ├── Controllers/             (Error controller classes)
    │   │   └── Defaults/                (Default error pages)
    │   ├── Controllers/                 (Application-wide MVC controllers)
    │   │   ├── Http/                    (HTTP request controllers)
    │   │   └── Cli/                     (CLI command controllers)
    │   └── Modules/                     (HMVC self-contained modules)
    │       ├── Controllers/             (Shared module controllers)
    │       │   ├── Http/                (HTTP request controllers)
    │       │   └── Cli/                 (CLI command controllers)
    │       ├── Models/                  (Shared module models)
    │       ├── Views/                   (Shared module views)
    │       └── <Module>/                (Individual module, e.g. Blog)
    │           ├── Controllers/         (Module-specific controllers)
    │           │   ├── Http/            (HTTP request controllers)
    │           │   └── Cli/             (CLI command controllers)
    │           ├── Models/              (Module-specific models)
    │           └── Views/               (Module-specific views)
    ├── bin/                             (Executable and Novakit console commands definitions)
    ├── public/                          (Web server document root)
    │   ├── index.php                    (Application front controller)
    │   ├── .htaccess                    (Apache configuration)
    │   └── assets/                      (Public CSS, JavaScript, images, etc.)
    ├── node/                            (JavaScript node module)
    │   └── libs/                        (Custom library files)
    ├── system/                          (Luminova framework core)
    │   └── plugins/                     (Third-party libraries and plugins)
    ├── resources/                       (Application resources)
    │   └── Views/                       (Shared view templates)
    ├── routes/                          (Method-Based routes definitions)
    └── writeable/                       (Runtime data and writable resources)
        ├── log/                         (Application and server logs)
        ├── storages/                    (Private application storage)
        └── caches/                      (Cache files)

Directory Overview

  • app/: Contains application-specific configuration, controllers, models, utilities, error handlers, and HMVC modules.
  • bin/: Contains executable files and Novakit console commands definitions.
  • public/: The only web-accessible application directory. It contains the front controller and publicly accessible static assets.
  • node/: Contains the application JavaScript Node Modules and packages.
  • system/: Contains Luminova's framework core and composer vendor in (plugins) directory.
  • resources/: Stores shared application resources.
  • resources/View/: Contains application view templates.
  • writeable/: Stores application private storage and runtime-generated files such as temp, logs, caches, and other private application data.

Important:

Configure your web server's document root to point exclusively to /var/www/example.com/public.Keep the remaining project directories outside the web-accessible document root to protect application source code, configuration files, and private runtime data.