Skip to content

Web Servers

To run an Aurora application, you can use various web servers. This section covers the configuration for the PHP built-in server, Apache, Nginx, and IIS.

PHP built-in server

To start a local web server using the PHP built-in server, execute the following command in the terminal, assuming that ./public/ is the publicly accessible directory containing an index.php file:

bash
cd public/
php -S localhost:8000

If your entry point is not index.php, adjust the command accordingly.

Apache configuration

To configure Apache for an Aurora application, ensure that the mod_rewrite and mod_actions modules are installed and enabled:

bash
sudo a2enmod rewrite
sudo a2enmod actions

Place the .htaccess and index.php files in the same publicly accessible directory. The .htaccess file should contain the following:

bash
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

Nginx configuration

Here is an example Nginx virtual host configuration for the domain example.com. It listens for incoming HTTP connections on port 80 and assumes a PHP-FPM server is running on port 8000.

nginx
server {
    listen 80;
    server_name example.com;
    index index.php;
    error_log /path/to/example.error.log;
    access_log /path/to/example.access.log;
    root /path/to/public;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php {
        try_files $uri = 404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:8000;
    }
}

IIS

To configure IIS for an Aurora application, ensure that both the Web.config and index.php files are in the same publicly accessible directory. The Web.config file should include the following code:

xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="slim" patternSyntax="Wildcard">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Released under the MIT License.