Skip to content

Commit f18fdcc

Browse files
authored
Update nginx_configation.md
1 parent d4beba1 commit f18fdcc

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

turbostack_configuration/nginx_configation.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,40 @@ order: 70
33
---
44

55
# Nginx configuration
6+
7+
## Enable Basic Authentication on your website for NGINX
8+
9+
It's relatively easy to configure Basic Authentication using a .htpasswd file (similar to a basic auth block in Apache .htaccess) in NGINX on TurboStack. This way you can block access to your development version of the website for non-authenticated users. This guide assumes you know what Basic Authentication is.
10+
11+
## How-to
12+
First locate your nginx main configuration file from the home directory of your user:
13+
14+
```
15+
vim nginx/50main.conf
16+
```
17+
18+
Then, uncomment the following lines to activate Basic Authentication:
19+
```
20+
location / {
21+
#auth_basic "Administrator’s Area";
22+
#auth_basic_user_file /var/www/staging/.secrets/htpasswd;
23+
#satisfy any;
24+
```
25+
26+
OPTIONAL: You can add whitelisting based on IP-addresses for connections that will not need to identify using the Basic Auth service, simply add "allow ":
27+
```
28+
location / {
29+
auth_basic "Administrator’s Area";
30+
auth_basic_user_file /var/www/staging/.secrets/htpasswd;
31+
allow 35.187.75.91;
32+
allow 34.76.59.175;
33+
allow 34.76.201.228;
34+
allow 87.233.217.242/28;
35+
satisfy any;
36+
```
37+
38+
39+
Lastly, to enact your changes, reload the NGINX service:
40+
```
41+
tscli nginx reload
42+
```

0 commit comments

Comments
 (0)