Difference between revisions of "KB00005:Web Server Configuration"

From PartKeepr Wiki
Jump to: navigation, search
Line 16: Line 16:
 
     # Use app.php as index
 
     # Use app.php as index
 
     index app.php;
 
     index app.php;
 +
 +
    location /setup {
 +
        index index.html;
 +
    }
 +
 +
    location / {
 +
        # try to serve file directly, fallback to app.php
 +
        try_files $uri /app.php$is_args$args;
 +
    }
  
 
     # This is required for the setup to detect if this KB article has been implemented
 
     # This is required for the setup to detect if this KB article has been implemented

Revision as of 14:17, 4 December 2015

PartKeepr requires special configuration in some cases.

Apache

Apache requires the following settings:

nginx

You need to configure nginx so that it passes the path_info to PHP, that is, everything which is added after a PHP script (like setup.php/test). Also make sure you set your root directory to your PartKeepr web/ directory.

    # Use app.php as index
    index app.php;

    location /setup {
        index index.html;
    }

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

    # This is required for the setup to detect if this KB article has been implemented
    rewrite ^/setup\/webserver-test$ /setup/tests/webservercheck.json;

    location ~ ^/(app_dev|config|setup)\.php(/|$) {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
        # for more information).
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
    }
    # PROD
    location ~ ^/app\.php(/|$) {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
        # for more information).
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        # Prevents URIs that include the front controller. This will 404:
        # http://domain.tld/app.php/some-path
        # Remove the internal directive to allow URIs like this
        internal;
    }