Is it possible to mix some configuration settings in Nginx? For example there is the auth_basic, which should work everywhere. And there is some other configuration spefic for one directory. Or there is the PHP interpreter...
# conf A
location / {
try_files $uri $uri/ =404;
auth_basic $auth;
auth_basic_user_file /var/www/admin/.htpasswd;
}
# conf B
location /awstats/classes/ {
alias /usr/local/awstats/wwwroot/classes/;
}
# conf C
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
So what happens here: If the request ends with .php, the auth_basic doesn't work. On any request to /awstats/classes/ the auth_basic doesn't work.
Is there a way to cascade or mix different configurations? So Nginx uses conf A AND B for example?
Yes. For this to work, you should read the documentation about
location
matching.