civicrm-docs-v2018.conf 2.9 KB
Newer Older
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
server {
    server_name v2018.docs.civicrm.dev.mjco.uk;
    root /var/www/civicrm-docs-v2018/web;

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

    # 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/)[^/]+/[^/]+/[^/]+ {
        # - 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.
        try_files $uri/ $uri /app_dev.php$is_args$args;
    }

    # requests for Symfony app functionality
    location / {
        # - Don't use a trailing slash for $uri here. This line is straight from
        #   the Symfony recommended nginx settings
        try_files $uri /app_dev.php$is_args$args;
    }

    location ~ ^/app_dev\.php(/|$) {
        fastcgi_pass unix:/var/run/php/php7.1-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;
    }

    # 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$ {
        return 404;
    }

    error_log /var/log/nginx/civicrm-docs-error.log;
    access_log /var/log/nginx/civicrm-docs-access.log;



    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/v2018.docs.civicrm.dev.mjco.uk/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/v2018.docs.civicrm.dev.mjco.uk/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = v2018.docs.civicrm.dev.mjco.uk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name v2018.docs.civicrm.dev.mjco.uk;
    listen 80;
    return 404; # managed by Certbot


}