Installation
PHP
A PHP version 8.4 or higher is required.Server
MageWork is compatible with any web server.
You just need to set 2 environment variables:
- MW_ENVIRONMENT: The environment name (local, prod, staging...). This variable is used to read the configuration file in the
etc
directory:etc/config.{MW_ENVIRONMENT}.php
. Default value if missing isdefault
. - MW_DEVELOPER_MODE: Display PHP error. Always set
0
in production. Default value if missing is0
.
If you can't add environment variables, you need to use etc/config.default.php
as configuration file.
Root
Configure the web server to serve the pub
directory.
Examples
Apache
<VirtualHost *:80> ServerName localhost.magework DocumentRoot /var/www/magework/pub SetEnv MW_DEVELOPER_MODE 1 SetEnv MW_ENVIRONMENT local <Directory /var/www/magework/pub> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/magework.log </VirtualHost>
Nginx
server { listen 80; listen [::]:80; root /var/www/magework/pub; server_name localhost.magework; index index.php index.html; charset utf-8; autoindex off; add_header X-Frame-Options "DENY"; add_header X-UA-Compatible "IE=Edge"; add_header X-XSS-Protection "1; mode=block"; add_header X-Content-Type-Options "nosniff"; location ~ /\.ht { deny all; } location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.4-fpm.sock; fastcgi_param MW_DEVELOPER_MODE 1; fastcgi_param MW_ENVIRONMENT local; } }