tangled
alpha
login
or
join now
sullen.net
/
nx
0
fork
atom
A simple utility to manage Nginx configurations.
0
fork
atom
overview
issues
pulls
pipelines
Update README
sullen.net
1 month ago
3ab82810
0942c5e0
+52
-9
1 changed file
expand all
collapse all
unified
split
README.md
+52
-9
README.md
···
1
1
# NX - Nginx Site Manager
2
2
3
3
-
A lightweight, colorized Bash utility to manage Nginx virtual hosts using the sites-available / sites-enabled pattern.
3
3
+
A lightweight, colorized Bash utility to manage Nginx virtual hosts using the `sites-available` / `sites-enabled` pattern.
4
4
5
5
-
It replaces the need for manual ln -s and rm commands with a simple, human-readable interface.
5
5
+
It replaces the need for manual `ln -s` and `rm` commands with a simple, human-readable interface.
6
6
7
7
## Features
8
8
9
9
* Tree-view Listing: Automatically groups subdomains under their parent domains using ASCII logic.
10
10
+
```
11
11
+
$ sudo nx list
12
12
+
SITE STATUS
13
13
+
---------------------------------------- ----------
14
14
+
example.com Enabled
15
15
+
└── knot.example.com Enabled
16
16
+
└── pds.example.com Enabled
17
17
+
└── statusphere.example.com Enabled
18
18
+
default Disabled
19
19
+
example.net Enabled
20
20
+
└── staging.example.net Enabled
21
21
+
└── wiki.example.net Disabled
22
22
+
└── ws.example.net Disabled
23
23
+
```
10
24
* Status Indicators: Color-coded feedback for "Enabled" (Green) and "Disabled" sites.
11
25
* Smart Suffixes: Automatically handles .conf extensions so you don't have to type them.
12
26
* Integrated Testing: Prompts to run nginx -t and reload the service after every edit or toggle.
13
27
* Config Preview: Uses batcat (with syntax highlighting) if installed, otherwise falls back to cat.
28
28
+
```bash
29
29
+
$ sudo nx print knot.example.com
30
30
+
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
31
31
+
│ File: /etc/nginx/sites-available/knot.example.com.conf
32
32
+
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
33
33
+
1 │ server {
34
34
+
2 │ listen 443 ssl;
35
35
+
3 │ listen [::]:443 ssl;
36
36
+
4 │ server_name knot.example.com;
37
37
+
5 │
38
38
+
6 │ ssl_certificate /etc/ssl/acme/example.com/fullchain.pem;
39
39
+
7 │ ssl_certificate_key /etc/ssl/acme/example.com/key.pem;
40
40
+
8 │
41
41
+
9 │ access_log /var/log/nginx/example.access.log main;
42
42
+
10 │
43
43
+
11 │ location / {
44
44
+
12 │ proxy_pass http://127.0.0.1:5555;
45
45
+
13 │ proxy_http_version 1.1;
46
46
+
14 │
47
47
+
15 │ proxy_set_header Upgrade $http_upgrade;
48
48
+
16 │ proxy_set_header Connection $connection_upgrade;
49
49
+
17 │
50
50
+
18 │ proxy_set_header Host $host;
51
51
+
19 │ proxy_set_header X-Real-IP $remote_addr;
52
52
+
20 │ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
53
53
+
21 │ proxy_set_header X-Forwarded-Proto $scheme;
54
54
+
22 │ }
55
55
+
23 │ }
56
56
+
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
57
57
+
```
14
58
15
59
## Installation
16
60
···
36
80
4. Ensure that your main Nginx config (e.g., `/etc/nginx/nginx.conf`) attempts to load in configurations
37
81
at `/etc/nginx/sites-enabled/*` (or wherever you'd like to store your configurations).
38
82
39
39
-
For example, your `/etc/nginx/nginx.conf` should contain the following:
40
40
-
```conf
41
41
-
# ...
83
83
+
```conf
84
84
+
# ...
42
85
43
43
-
http {
44
44
-
# ...
86
86
+
http {
87
87
+
# ...
45
88
include /etc/nginx/sites-enabled/*;
46
46
-
}
47
47
-
```
89
89
+
}
90
90
+
```
48
91
49
92
## Usage
50
93