summaryrefslogblamecommitdiffstats
path: root/srvs/nginx.conf
blob: a5e81f1038f12be30592c930e4b95a05645766d2 (plain) (tree)
















































































                                                                         
##
# SCROTT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to UNLICENSE
##

##
# This file is for configuring NGINX to work with Scrott.  This is not
# a complete configuration, just a simple and genaric server {} block
# to use as a starting-point for setting up your server.
##

server
{
    listen 80;
    listen [::]:80 ipv6only=on;
    listen 443 ssl;
    listen [::]:443 ssl ipv6only=on;

    # set to your instance #
    server_name localhost;
    root /usr/share/nginx/scrott;

    index index.php;
    keepalive_timeout 70;

    ##
    # Completely deny access to user-supplied content.  This content
    # should instead be served by the df.php script, to enforce
    # access permissions and prevent code-execution.
    ##
    location ^~ /dynmic
    {
        deny all;
        return 404;
    }

    ##
    # Allow direct access to built-in static content, instead of
    # passing these requests to the PHP system.
    ##
    location ^~ /static
    {
        try_files $uri $uri/ =404;
    }

    ##
    # Process normal requests via (clean) url rewriting.  Unless
    # the requested path exists on disk, pass it to index.php
    # for processing.
    ##
    location /
    {
        rewrite ^(.*)$ /index.php$1;
    }

    ##
    # Hand-off completed php rewrites (or direct requests) to
    # php-fpm for processing.
    ##
    location ~ [^/]\.php(/|$)
    {
        fastcgi_split_path_info ^((?U).+\.php)(.*)$;

        try_files $fastcgi_script_name =404;

        include fastcgi_params;
        set $path_info $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;

        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
    }
}