Skip to content

hikari-no-yume/sitecfg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sitecfg

sitecfg is a small PHP script I use to manage my websites. It automatically checks out the git repository, symlinks its webroot in /var/www, symlinks its nginx config file to /etc/nginx/sites-available and -enabled, and reloads nginx.

For usage, see php sitecfg.php.

Configuration

There are two configuration files. The first is config.json (copy config.example.json to get started), which contains these keys:

  • "owner" and "group" - The username (probably your username) and group name (most likely www-data or nginx) that the git repository will be chmoded to be owned by ("owner" is not used for "user" sites, which are chowned to their user)
  • "sitesDir" - The directory that the git repositories will be put in, e.g. /home/your_username/sites

The second is sites.json (copy sites.example.json to get started), which contains a key for each site. Each site's object contains these keys:

  • "type" - Can be:
    • "git" if we're using a git repo for our site
    • "user" if we want to create a user account and an empty htdocs directory in its home directory (so someone can SSH in and upload site content)
    • "dir" if we want an empty directory
  • "gitRepo" - ("git" sites only) The URL of a git repository which will be cloned (from GitHub, for example)
  • "user" - ("user" sites only) The username to give the user account
  • "nginxConfigFile" - The path of the nginx configuration file (which should use /var/www/site_name for its webroot) - for "git" sites this is relative to the repository e.g. example.com.cfg, and for "user" and "dir" sites this is absolute, e.g. /home/john_appleseed/sites/example.com.cfg
  • "webroot" - ("git" sites only - "user" and "dir" sites always create an htdocs directory) The path within that git repository of the webroot, e.g. htdocs (/var/www/site_name will be symlinked to point to this)

That's it!

About

Small PHP script I use to manage my websites

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages