Deployment
Depending on your server environment, SigmaPHP can be deployed using a compatible web server configuration. Example configuration files are provided to help you quickly route all requests through the framework's front controller.
To get started, copy the appropriate server configuration down below into the root of your project and rename it according to your web server requirements.
Apache Deployment
After copying and configuring the .htaccess file, ensure the
web server has the proper permissions to access and write to the project
directories.
sudo chmod -R g+w /var/www/html/my-app
sudo chown -R $USER:www-data /var/www/html/my-app
These commands grant the correct group permissions and assign ownership so Apache can properly serve the application and write to required directories such as cache or uploads.
RewriteEngine On
# If the request is for an existing file or directory, serve it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Front Controller: route everything public/index.php
RewriteRule ^ public/index.php [L]
Nginx Deployment
When using Nginx, copy the provided Nginx configuration example and include it inside your server block configuration. The important part is ensuring that all requests are forwarded to the application's front controller.
Update the root directive and the try_files rule
so requests fallback to public/index.php
After updating the configuration, reload Nginx to apply the changes and your SigmaPHP application should be accessible through your configured domain.
# add these lines to /etc/nginx/sites-available/your-app.conf
server {
listen 80;
server_name my-app.test;
root /var/www/html/my-app/public;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
# or add this line to your nginx config (nginx.conf) :
location / {
try_files $uri $uri/ /public/index.php?$query_string;
}