Web Server Setup for Flute CMS
A web server is a program that accepts requests from visitors’ browsers and serves them your website’s pages. The most popular web servers are Apache and Nginx. The key thing to configure correctly is the Document Root (the site’s root folder). Document Root tells the web server which folder on disk contains the files that should be accessible to visitors through a browser.
Proper web server configuration is critically important for Flute CMS to work correctly. This guide covers all popular control panels and servers.
Important! The site’s root folder must point to the public/ folder from the Flute CMS archive, not the project root!
Why specifically public/? This is a security concern. The Flute CMS project root contains configuration files with database passwords, internal folders like storage/, config/, vendor/, and other internal files. If the Document Root points to the project root, any visitor could access these files through the browser. The public/ folder contains only files that are safe to show visitors (index.php, styles, scripts, images).
Hosting Control Panels
FastPanel
FastPanel
FastPanel is a modern hosting control panel with a user-friendly interface.
Log into FastPanel
- Open your browser and navigate to your panel address (usually
https://example.com:8888) - Enter the administrator login and password
Create a site
- In the main menu, select “Sites”
- Click “Add Site”
- Fill in the fields:
- Domain: your domain (e.g.,
example.com) - PHP Version: select 8.2 or higher
- Root folder: leave the default or specify
public_html
- Domain: your domain (e.g.,
Configure PHP
- Go to the “PHP” section for your site
- Make sure the following extensions are enabled:
opcachepdo_mysqlgdbcmathjsonioncubembstringsimplexmlzipcurlgmp
Upload Flute CMS files
- In the “Files” section, navigate to the site folder
- Upload the Flute CMS archive
- Extract the archive in the site root, keeping the structure with the
public/folder
Configure Document Root
- In the site settings, find “Document Root”
- Set the path to the
public/folder inside the project (e.g.,/home/user/domains/example.com/publicor/home/user/domains/example.com/public_html/publicif the panel createdpublic_html) - Save the changes
The public/ folder is the only folder that should be accessible from the internet. All other project folders (config/, storage/, vendor/, etc.) contain confidential data and internal code. If the Document Root does not point to public/, attackers could gain access to configuration files containing database passwords and other sensitive information.
Create a database
- Go to the “Databases” section
- Click “Create Database”
- Fill in:
- Database name:
flute_cms - User: create a new user
- Password: generate a strong password
- Database name:
- Write down the connection details
FastPanel usually does not require additional .htaccess configuration — everything works automatically.
Direct Web Server Configuration
This section is intended for advanced users who want to configure the web server directly. If you are unsure what you are doing, it is better to use hosting control panels.
Apache
Apache
Configuration for the Apache web server.
Virtual Host
Create a virtual host configuration file:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/flute-cms/public
<Directory /var/www/flute-cms/public>
AllowOverride All
Require all granted
# Enable mod_rewrite
RewriteEngine On
# Route all requests through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
# Deny access to internal folders
<Directory /var/www/flute-cms/storage>
Require all denied
</Directory>
<Directory /var/www/flute-cms/config>
Require all denied
</Directory>
# Logs
ErrorLog ${APACHE_LOG_DIR}/flute-cms-error.log
CustomLog ${APACHE_LOG_DIR}/flute-cms-access.log combined
</VirtualHost>SSL Configuration
For HTTPS, add:
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/flute-cms/public
# SSL settings
SSLEngine on
SSLCertificateFile /path/to/certificate.crt
SSLCertificateKeyFile /path/to/private.key
SSLCertificateChainFile /path/to/chain.crt
# The rest of the configuration is the same as HTTP
<Directory /var/www/flute-cms/public>
AllowOverride All
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>
</VirtualHost>.htaccess File
Make sure the public/ folder contains an .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to HTTPS (optional)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Request handling
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
# Security
<Files "*.env">
Require all denied
</Files>
<Files "composer.*">
Require all denied
</Files>
# Static file caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>Verifying the Configuration
After setting up the web server, perform the following checks:
1. Check Accessibility
Open your site in a browser. You should see:
- The Flute CMS installation page (if installation is not complete)
- The site’s home page (if installation is complete)
2. Check PHP
Create a temporary info.php file in the site root:
<?php
phpinfo();
?>Open https://example.com/info.php and check:
- The PHP version (must be 8.2+)
- That all necessary extensions are present
- Opcache settings
Delete the info.php file after checking for security!
3. Check Access Permissions
Make sure the web server can write to the following folders:
storage/storage/logs/storage/app/cache/public/uploads/
4. Check .htaccess / URL Rewriting
Try opening a non-existent page (e.g., /test). You should see:
- A Flute CMS 404 page
- Or the installation page
If you see the web server’s default 404 error, URL rewriting is not configured correctly.
Possible Problems
500 Internal Server Error
Causes:
- Incorrect access permissions
- Missing PHP extensions
- Errors in .htaccess
- Insufficient PHP memory
Solution:
- Check the web server logs
- Enable PHP error display
- Check access permissions (755 or 777 for storage/)
- Increase memory_limit in PHP
404 Not Found Error
Causes:
- Incorrect Document Root
- URL rewriting not working
- Missing index.php
Solution:
- Make sure the Document Root points to the
public/folder - Ensure mod_rewrite is enabled (Apache) or try_files is configured (Nginx)
- Check that the
public/index.phpfile exists
White Page
Causes:
- PHP errors
- Insufficient memory
- Missing dependencies
Solution:
- Enable PHP error display
- Check the PHP logs
- Make sure the
vendor/folder exists and contains dependencies
File Upload Problems
Causes:
- Incorrect access permissions
- PHP file upload restrictions
Solution:
- Set permissions to 755 or 777 on
public/uploads/ - Check the
upload_max_filesizeandpost_max_sizesettings in PHP - Make sure
file_uploads = Onin PHP
If the problems persist, seek help in the Discord community or create an issue on GitHub .
Performance Optimization
After setting up the web server, it is recommended to:
- Enable Opcache to speed up PHP
- Configure caching for static files
- Enable compression (gzip/brotli)
For more details on optimization, see the Performance Optimization section.