civicrm-docs.conf 2.24 KB
Newer Older
1
server {
mickadoo's avatar
mickadoo committed
2 3 4
    server_name localhost;
    listen *:8080;
    root /var/www/web;
5

6 7 8
    # For a development configuration, change "app" to "app_dev" everywhere
    # below. Then you'll see the Symfony web debug toolbar when viewing pages.

9 10 11 12 13
    # Requests for static book files
    # - Book slug can't begin with underscore
    # - Book slug can't be "admin"
    # - Must begin with three distinct path pieces, separated by forward slashes
    location ~ ^/(?!_)(?!admin/)[^/]+/[^/]+/[^/]+ {
mickadoo's avatar
mickadoo committed
14 15 16 17
        # - Use a trailing slash for the $uri to treat paths like directories
        # - Then, try to find directories that match our request.
        # - If we can't find anything, we send the request to the app and let
        #   it deal with the rest.
mickadoo's avatar
mickadoo committed
18
        try_files $uri/ $uri /app_dev.php$is_args$args;
19 20 21
    }

    # requests for Symfony app functionality
22
    location / {
23
        # - Don't use a trailing slash for $uri here. This line is straight from
mickadoo's avatar
mickadoo committed
24
        #   the Symfony recommended nginx settings
mickadoo's avatar
mickadoo committed
25
        try_files $uri /app_dev.php$is_args$args;
26
    }
27

mickadoo's avatar
mickadoo committed
28 29
    location ~ ^/app_dev\.php(/|$) {
        fastcgi_pass unix:/var/run/php-fpm.sock;
30 31 32 33 34 35 36 37 38
        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).
39
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
40 41 42 43 44 45
        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;
    }
46 47 48 49

    # return 404 for all other php files not matching the front controller
    # this prevents access to other php files you don't want to be accessible.
    location ~ \.php$ {
mickadoo's avatar
mickadoo committed
50
        return 404;
51 52 53 54
    }

    #error_log /var/log/nginx/civicrm-docs-error.log;
    #access_log /var/log/nginx/civicrm-docs-access.log;
55
}
56