ssossossosso
Documentation Home »Installation Guide »Prepare Installation Environment »Install and Configure a Web Application Server
current version

Install and Configure a Web Application Server

Web Server Installation

Please follow the guidance in the official Apache and nginx documentation for detailed information on web server installation:

  • Apache 2.2
  • Apache 2.4
  • nginx

Web Server Configuration

The following sections contain the recommended configuration for supported web server types and versions.

Apache 2.2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<VirtualHost *:80>
    ServerName {$folder_name}.example.com

    DirectoryIndex app.php
    DocumentRoot [$folder_location]}/{$folder_name}/web
    <Directory  [$folder_location]}/{$folder_name}/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

    ErrorLog /var/log/apache2/{$folder_name}_error.log
    CustomLog /var/log/apache2/{$folder_name}_access.log combined
</VirtualHost>

Apache 2.4

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<VirtualHost *:80>
    ServerName {$folder_name}.example.com

    DirectoryIndex app.php
    DocumentRoot [$folder_location]}/{$folder_name}/web
    <Directory  [$folder_location]}/{$folder_name}/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/apache2/{$folder_name}_error.log
    CustomLog /var/log/apache2/{$folder_name}_access.log combined
</VirtualHost>

Note

Please make sure mod_rewrite and mod_headers are enabled.

Nginx

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
    server_name {$folder_name}.example.com;
    root  [$folder_location]}/{$folder_name}/web;

    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /app.php$is_args$args;
    }

    location ~ ^/(app|app_dev|config|install)\.php(/|$) {
        fastcgi_pass 127.0.0.1:9000;
        # or
        # fastcgi_pass unix:/var/run/php/php7-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }

    error_log /var/log/nginx/{$folder_name}_error.log;
    access_log /var/log/nginx/{$folder_name}_access.log;
}

Caution

Make sure that the web server user has permissions for the log directory of the application.

More details on the file permissions configuration are available in the official Symfony documentation

Browse maintained versions:
current1.4