Files @ 467a66f3ec65
Branch filter:

Location: majic-ansible-roles/roles/php_website/templates/nginx_site.j2

branko
MAR-5: Added handler for reloading systemd configuration to common role. Dropped installation of supervisor as part of web server role. Updted web server role to create directory for storing WSGI application sockets. Updated web server role to use correct directory for storing PHP website sockets.
server {
    listen 80;

    root {{ home }}/htdocs/;

    index index.php;

    server_name {{ fqdn }};

    # Site rewrites.
    {% for rewrite in rewrites -%}
    rewrite {{ rewrite }};
    {% endfor %}

    # Interpret PHP files via FastCGI.
    location ~ \.php($|/) {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php5-fpm/{{ fqdn }}.sock;
    }

    # Deny access to all hidden files (this will prevent access to
    # .htaccess too).
    location ~ /\. {
        deny all;
    }

    {% for regex in deny_files_regex -%}
    # Deny access to user-specified files.
    location ~ {{ regex }} {
        deny all;
    }
    {% endfor %}

    {% if php_rewrite_url -%}
    # Serve the remaining files directly or rewrite request for PHP processing
    # (clean URLs).
    location ~ /(.*) {
        set $suburi $1;
	try_files $uri $uri/ {{ php_rewrite_url }};
    }
    {% endif %}

    access_log /var/log/nginx/{{ fqdn }}-access.log;
    error_log /var/log/nginx/{{ fqdn }}-error.log;
}