A simple utility to manage Nginx configurations.

Update README

+48 -5
+48 -5
README.md
··· 12 12 * Integrated Testing: Prompts to run nginx -t and reload the service after every edit or toggle. 13 13 * Config Preview: Uses batcat (with syntax highlighting) if installed, otherwise falls back to cat. 14 14 15 + ## Prerequisites 16 + 17 + To use this utility ensure that your main Nginx config (e.g., `/etc/nginx/nginx.conf`) attempts to load in configurations 18 + at `/etc/nginx/sites-enabled/*` (or wherever you'd like to store your configurations). 19 + 20 + For example, your `/etc/nginx/nginx.conf` should contain the following: 21 + ```conf 22 + # ... 23 + 24 + http { 25 + # ... 26 + include /etc/nginx/sites-enabled/*; 27 + } 28 + ``` 29 + 15 30 ## Installation 16 31 17 32 To install nx system-wide while keeping the source code in this repository for easy updates: 18 33 19 - 1. Move the repository to a permanent location: 34 + 1. Move the repository to a permanent location (e.g., your home dir or a projects dir): 20 35 ```bash 21 - mkdir -p ~/projects 22 - mv nx-manager ~/projects/ 23 - cd ~/projects/nx-manager 36 + cd ~ 37 + git clone https://tangled.org/sullen.net/nx 38 + cd nx 24 39 ``` 25 40 26 41 2. Make the script executable: 42 + ```bash 27 43 chmod +x nx 44 + ``` 28 45 29 46 3. Create a symbolic link in your PATH: 47 + ```bash 30 48 sudo ln -s $(pwd)/nx /usr/local/bin/nx 49 + ``` 31 50 32 51 ## Usage 33 52 ··· 39 58 - Edit config: sudo nx e mydomain.com 40 59 - Print config: nx p mydomain.com 41 60 61 + ```bash 62 + NX - Nginx Site Manager 63 + 64 + A simple utility to manage Nginx configurations. 65 + 66 + USAGE: 67 + nx <command> [arguments] 68 + 69 + COMMANDS: 70 + list, l List all sites. Supports --enabled or --available filters. 71 + enable <site> Enable a site by creating a symlink. 72 + disable <site> Disable a site by removing the symlink. 73 + edit, e <site> Open site config in $EDITOR. 74 + cat, print, p <site> Preview site config using batcat or cat. 75 + 76 + EXAMPLES: 77 + sudo nx list 78 + sudo nx enable mydomain.com 79 + sudo nx e mydomain.com 80 + 81 + ENVIRONMENT: 82 + $EDITOR: Currently set to nano 83 + ``` 84 + 42 85 ## Environment Variables 43 86 44 87 The edit command respects your preferred editor. You can set this in your ~/.bashrc or ~/.zshrc: ··· 50 93 51 94 ## License 52 95 53 - MIT 96 + MIT