Reputation: 20223
I would like to set the auth_basic globally for all the projects with nginx.
It works well by setting in on every project conf with:
auth_basic "DEV restricted access";
auth_basic_user_file /var/www/passwd;
In order to avoid this to be forgot for new projects, I would like to set this globally. Is it possible?
Upvotes: 2
Views: 877
Reputation: 101
Create file:
/etc/nginx/conf.d/pick-your-name.conf
and put there this piece of text:
auth_basic "DEV restricted access";
auth_basic_user_file /var/www/passwd;
Works the same as placing it straight into nginx.conf but keeps your configuration clean.
Upvotes: 0
Reputation: 49812
According to the manual, auth_basic can be configured globally by placing the commands within the http
block.
Depending on your particular flavour of OS, start with the master nginx.conf
configuration file, and find the http { ... }
section or possibly an auxiliary configuration file which is pulled into it using an include
statement.
Upvotes: 3