/sites-cli

Simple PHP CLI for managing document root directories.

Primary LanguagePHPMIT LicenseMIT

sites-cli

Simple PHP CLI for managing document root directories.

This utility allows you to quickly switch the directory being served by your web server. The script simply updates a symbolic link that you configure Apache/NGINX/IIS to serve from.

This is useful for users who do not want to use virtual hosts but wish to serve from multiple directories.

Requirements

  • Bash shell

  • PHP 5+

Setup

  1. Download the script
    cd /usr/local/bin && curl -O https://raw.githubusercontent.com/kamprath/sites-cli/master/sites

  2. Make the script executable
    sudo chmod u+x /usr/local/bin/sites

  3. Run sites from your terminal
    The first time that sites is run, you will be prompted with configuration.

  4. Configure your web server to serve from the symlink
    Configure your web server's settings to serve from the symbolic link file that was created and restart the web server.

Usage

Add a site
To add a site, use sites add <name> <absolute path>.

Use a site
To switch the active sites being served, use sites use <name>.

List sites
To list all sites that have been added, simply run sites.

Show command help
To a list of available command options, run sites help.