Skip to content

nginx with alias example #5

@stbuehler

Description

@stbuehler

nginx doesn't allow combining rewrite and alias, so this is a little bit difficult. This is the best I came up with so far:

~~~~ nginx with alias ~~~~

# nginx doesn't allow combining rewrite and alias
# also set $__config['site']['url'] accordingly

location /paste/ {
	alias /srv/ncrypt/;
	index not-existing-file;

	fastcgi_split_path_info ^(/paste)(/.+)$;
	include fastcgi.conf; # default fastcgi params
	# overwrite some params
	fastcgi_param SCRIPT_FILENAME $document_root/index.php;
	fastcgi_param PATH_INFO $fastcgi_path_info;

	if (!-f $request_filename) {
		fastcgi_pass php-backend;
	}

	# there is no need to access any php file directly
	location ~ \.php$ {
		deny all;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions