1111
1212## Table of Contents
1313
14-
15141 . [ Description] ( #description )
16152 . [ Reference API] ( #reference-api )
17163 . [ Prerequisites] ( #prerequisites )
20196 . [ Usage] ( #usage )
21207 . [ Options] ( #options )
22218 . [ 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 )
282810 . [ TODO] ( #todo )
2929
3030> [ !WARNING]
@@ -57,12 +57,15 @@ Il facilite l'automatisation des tâches courantes, comme l'ajout de proxies, la
5757
5858The excellent NPM (![ Nginx Proxy Manager] ( https://github.com/NginxProxyManager/nginx-proxy-manager?utm_source=nginx-proxy-manager ) )
5959
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:
6264
6365- ` curl `
6466- ` jq `
6567
68+ </details >
6669
6770## Installation
6871``` bash
@@ -73,10 +76,6 @@ chmod +x npm-api.sh
7376```
7477
7578
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-
8079## Settings
8180> [ !IMPORTANT]
8281> (Optional) You can create a configuration file named ` npm-api.conf ` with these 4 required variables.
@@ -195,48 +194,67 @@ API_PASS="changeme"
195194## Examples
196195
197196``` bash
198- 📦 Backup First !
197+ 📦 Backup First !
199198 ./npm-api.sh --backup
200199
201200 🌐 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
209214
210215 🤖 Automatic operations (no prompts):
211216 ./npm-api.sh --host-create example.com -i 192.168.1.10 -p 8080 -y
212217 ./npm-api.sh --host-delete 42 -y
213218 ./npm-api.sh --host-ssl-enable 10 -y
214219
215220 🔍 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
219228
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
224235
225236 🛡️ Access Control Lists:
226237 ./npm-api.sh --list-access # List all access lists
227238 ./npm-api.sh --host-acl-enable 42,5 # Enable ACL ID 5 for host 42
228239 ./npm-api.sh --host-acl-disable 42 # Disable ACL for host 42
229240
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;'
233250
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
236256 ./npm-api.sh --update-host 42 forward_scheme=https
237257 ./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
240258
241259 🔧 Advanced Example:
242260 ./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"
258276./npm-api.sh --backup
259277```
260278
261-
262-
263-
264-
265279### 💾 Backup Operations
266280
267281#### Schema of the backup directory:
0 commit comments