Documentation Home »Installation Guide »Manual Installation »Related Information »Configure a Web Server
2.6 version

Configure a Web 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
23
24
25
26
27
28
    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;
        }

        location ~* ^[^(\.php)]+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ {
           access_log off;
           expires 1h;
           add_header Cache-Control public;
        }

        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:
3.01.122.02.32.6

You will be redirected to [title]. Would you like to continue?

Yes No
sso for www.magecore.comsso for oroinc.desso for oroinc.frsso for marketplace.orocommerce.comsso for marketplace.orocrm.com