A collection of tools to automate virtual host administration for nginx.
Boring stuff: (c) Copyright Author: Maximilian 'cyrusol' Pfeifer, [email protected] Date: 2013-10-13 License: MIT Version: 1.0
=============================================================================
Included are: ngxvhadd Adds a new vhost ngxvhdel Deletes a vhost ngxvhen Enables a vhost ngxvhdis Disables a vhost
=============================================================================
Requirements: nginx mariadb / mysql openssh
=============================================================================
Preparations:
-
Prepare the chroot directory: mkdir /home/jail
-
Prepare the skel directory: mkdir /root/vhost mkdir /root/vhost/public
-
Prepare openssh for chrooted sftp Append following lines to sshd_config:
Match Group vhost AuthorizedKeysFile /home/vhost/%u/.ssh/authorized_keys ChrootDirectory /home/vhost/%u AllowTcpForwarding no X11Forwarding no ForceCommand internal-sftp
or change them according to your needs. If your openssh is too old to support AuthorizedKeysFile in a Match block, consider the AuthorizedKeysFile2 global option.
-
Write your nginx vhost configs and save them at /etc/nginx/sites-available/vh-.