···1212* Integrated Testing: Prompts to run nginx -t and reload the service after every edit or toggle.
1313* Config Preview: Uses batcat (with syntax highlighting) if installed, otherwise falls back to cat.
14141515+## Prerequisites
1616+1717+To use this utility ensure that your main Nginx config (e.g., `/etc/nginx/nginx.conf`) attempts to load in configurations
1818+at `/etc/nginx/sites-enabled/*` (or wherever you'd like to store your configurations).
1919+2020+For example, your `/etc/nginx/nginx.conf` should contain the following:
2121+```conf
2222+# ...
2323+2424+http {
2525+ # ...
2626+ include /etc/nginx/sites-enabled/*;
2727+}
2828+```
2929+1530## Installation
16311732To install nx system-wide while keeping the source code in this repository for easy updates:
18331919-1. Move the repository to a permanent location:
3434+1. Move the repository to a permanent location (e.g., your home dir or a projects dir):
2035 ```bash
2121- mkdir -p ~/projects
2222- mv nx-manager ~/projects/
2323- cd ~/projects/nx-manager
3636+ cd ~
3737+ git clone https://tangled.org/sullen.net/nx
3838+ cd nx
2439 ```
254026412. Make the script executable:
4242+ ```bash
2743 chmod +x nx
4444+ ```
284529463. Create a symbolic link in your PATH:
4747+ ```bash
3048 sudo ln -s $(pwd)/nx /usr/local/bin/nx
4949+ ```
31503251## Usage
3352···3958- Edit config: sudo nx e mydomain.com
4059- Print config: nx p mydomain.com
41606161+```bash
6262+NX - Nginx Site Manager
6363+6464+A simple utility to manage Nginx configurations.
6565+6666+USAGE:
6767+ nx <command> [arguments]
6868+6969+COMMANDS:
7070+ list, l List all sites. Supports --enabled or --available filters.
7171+ enable <site> Enable a site by creating a symlink.
7272+ disable <site> Disable a site by removing the symlink.
7373+ edit, e <site> Open site config in $EDITOR.
7474+ cat, print, p <site> Preview site config using batcat or cat.
7575+7676+EXAMPLES:
7777+ sudo nx list
7878+ sudo nx enable mydomain.com
7979+ sudo nx e mydomain.com
8080+8181+ENVIRONMENT:
8282+ $EDITOR: Currently set to nano
8383+```
8484+4285## Environment Variables
43864487The edit command respects your preferred editor. You can set this in your ~/.bashrc or ~/.zshrc:
···50935194## License
52955353-MIT9696+MIT