11
11
12
12
## Table of Contents
13
13
14
-
15
14
1 . [ Description] ( #description )
16
15
2 . [ Reference API] ( #reference-api )
17
16
3 . [ Prerequisites] ( #prerequisites )
20
19
6 . [ Usage] ( #usage )
21
20
7 . [ Options] ( #options )
22
21
8 . [ Examples] ( #examples )
23
- - [ Info script] ( #info )
24
- - [ List HOST] ( #list )
25
- - [ Enable SSL] ( #ssl )
26
- - [ Update specific fields of an existing proxy host] ( #update )
27
- 9 . [ Important Notice] ( #-important-notice-repository-history-rewritten )
22
+ - [ Backup] ( #backup )
23
+ - [ Script Info] ( #script-info )
24
+ - [ Host List] ( #host-list )
25
+ - [ SSL Enable] ( #host-ssl-enable )
26
+ - [ Host Update] ( #host-update )
27
+ 9 . [ Important Notice] ( #important-notice-repository-history-rewritten )
28
28
10 . [ TODO] ( #todo )
29
29
30
30
> [ !WARNING]
@@ -57,12 +57,15 @@ Il facilite l'automatisation des tâches courantes, comme l'ajout de proxies, la
57
57
58
58
The excellent NPM (![ Nginx Proxy Manager] ( https://github.com/NginxProxyManager/nginx-proxy-manager?utm_source=nginx-proxy-manager ) )
59
59
60
- Required basic dependencies.
61
- > The script will automatically check if they are installed and will download them if necessary:
60
+
61
+ <details >
62
+ <summary >Required basic dependencies.</summary >
63
+ The script will automatically check if they are installed and will download them if necessary:
62
64
63
65
- ` curl `
64
66
- ` jq `
65
67
68
+ </details >
66
69
67
70
## Installation
68
71
``` bash
@@ -73,10 +76,6 @@ chmod +x npm-api.sh
73
76
```
74
77
75
78
76
- > [ !NOTE]
77
- > With the new ` V2.0.0 ` , some command arguments have been changed to be simpler, and need to set ` BASE_DIR ` variable to store ` Tokens ` and ` Backups ` .
78
-
79
-
80
79
## Settings
81
80
> [ !IMPORTANT]
82
81
> (Optional) You can create a configuration file named ` npm-api.conf ` with these 4 required variables.
@@ -195,48 +194,67 @@ API_PASS="changeme"
195
194
## Examples
196
195
197
196
``` bash
198
- 📦 Backup First !
197
+ 📦 Backup First !
199
198
./npm-api.sh --backup
200
199
201
200
🌐 Host Creation:
202
- ./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 (check default values below)
203
- ./npm-api.sh --info
204
- ./npm-api.sh --show-default
205
- ./npm-api.sh --create-user newuser password123 user@example.com
206
- ./npm-api.sh --delete-user ' username'
207
- ./npm-api.sh --host-list
208
- ./npm-api.sh --host-ssl-enable 10
201
+ # Basic host creation
202
+ ./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080
203
+
204
+ # Create host with SSL certificate and enable SSL (all-in-one)
205
+ ./npm-api.sh --host-create sub.domain.com -i 192.168.0.1 -p 80 --generate-cert --host-ssl-enable -y
206
+
207
+ # Create host with custom options
208
+ ./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 \
209
+ -f https \ # Forward scheme
210
+ -b true \ # Block exploits
211
+ -c true \ # Enable caching
212
+ -w true \ # Enable websocket
213
+ -y # Auto confirm
209
214
210
215
🤖 Automatic operations (no prompts):
211
216
./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 -y
212
217
./npm-api.sh --host-delete 42 -y
213
218
./npm-api.sh --host-ssl-enable 10 -y
214
219
215
220
🔍 Information and Status:
216
- ./npm-api.sh --info # Show script configuration and status
217
- ./npm-api.sh --check-token # Verify token validity
218
- ./npm-api.sh --host-search domain.com # Search for a specific domain
221
+ ./npm-api.sh --info # Show configuration and dashboard
222
+ ./npm-api.sh --show-default # Show default settings
223
+ ./npm-api.sh --check-token # Verify token validity
224
+ ./npm-api.sh --host-search domain.com # Search for a specific domain
225
+ ./npm-api.sh --host-list # List all hosts
226
+ ./npm-api.sh --host-list-full # List hosts with details
227
+ ./npm-api.sh --host-show 42 # Show specific host details
219
228
220
- 🔄 Host Management:
221
- # Enable/Disable hosts
222
- ./npm-api.sh --host-enable 42
223
- ./npm-api.sh --host-disable 42
229
+ 🔒 SSL Management:
230
+ ./npm-api.sh --list-ssl-cert # List all certificates
231
+ ./npm-api.sh --generate-cert domain.com # Generate Let's Encrypt cert
232
+ ./npm-api.sh --delete-cert domain.com # Delete certificate
233
+ ./npm-api.sh --host-ssl-enable 42 # Enable SSL for host
234
+ ./npm-api.sh --host-ssl-enable 42 33 # Enable SSL with specific cert ID
224
235
225
236
🛡️ Access Control Lists:
226
237
./npm-api.sh --list-access # List all access lists
227
238
./npm-api.sh --host-acl-enable 42,5 # Enable ACL ID 5 for host 42
228
239
./npm-api.sh --host-acl-disable 42 # Disable ACL for host 42
229
240
230
- 🔒 SSL Management:
231
- ./npm-api.sh --list-ssl-cert # List all SSL certificates
232
- ./npm-api.sh --delete-cert domain.com # Delete certificate for domain
241
+ 👥 User Management:
242
+ ./npm-api.sh --create-user newuser password123 user@example.com
243
+ ./npm-api.sh --delete-user ' username'
244
+ ./npm-api.sh --list-users
245
+
246
+ 🔧 Advanced Examples:
247
+ # Custom Nginx configuration
248
+ ./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 \
249
+ -a ' proxy_set_header X-Real-IP $remote_addr;'
233
250
234
- 🔄 Update Specific Fields:
235
- # Update individual fields without recreating the entire host
251
+ # Custom locations
252
+ ./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 \
253
+ -l ' [{"path":"/api","forward_host":"192.168.1.11","forward_port":8081}]'
254
+
255
+ # Update specific fields
236
256
./npm-api.sh --update-host 42 forward_scheme=https
237
257
./npm-api.sh --update-host 42 forward_port=8443
238
- ./npm-api.sh --update-host 42 block_exploits=true
239
- ./npm-api.sh --update-host 42 allow_websocket_upgrade=true
240
258
241
259
🔧 Advanced Example:
242
260
./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 -a ' proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;'
@@ -258,10 +276,6 @@ API_PASS="changeme"
258
276
./npm-api.sh --backup
259
277
```
260
278
261
-
262
-
263
-
264
-
265
279
### 💾 Backup Operations
266
280
267
281
#### Schema of the backup directory:
0 commit comments