WebServer

Downloads
1.3.0
2012 to 2016
Stable

If you're an owner of a virtual or dedicated Linux server, you know the hassle with third party tools. They need to be maintained, could break after any upgrade and there is no such thing as "full control". What are you doing next, after you upgraded a heavy software toolchain, leaving you with error 500?

There are several web server management solutions. Well known panels include Plesk (in present) and Confixx (in past). These are all easy to use and include lots of statistics and information as well. Additionally, administrators can create resellers who can create users and so on. But if you just own a dedicated server by yourself, you may prefer control over features, especially if most features are not much of interest.

Prerequisites

Install following packages:

apt-get install proftpd apache2 mysql-server

Important: Uncomment following two lines in "/etc/proftpd/proftpd.conf" by removing the "#":

DefaultRoot ~
RequireValidShell off

This will jail web users into their home directory and disable shell. In case someone gained access to one web user, they will not be able to access other directories, for instance, /home.

webserver.sh

Place the script in /root/webserver.sh. Set $MYSQLROOTPASSWORD in webserver.conf to the password of the MySQL root user (not to be confused with the Linux root user).

vHosts

Manage the vHosts yourself in /etc/apache2/sites-available. Read more. You need to use "./webserver.sh reload apache2" every time you change your vHosts configuration.

Usage

Add users with "./webserver.sh useradd <USER>" and set the password and MySQL password first. Both passwords are random and not known by default, so you have to change them first. Next, log into this user account via FTP. You probably also want to install phpMyAdmin on your server if you want a web based database administration tool.

Recommended: Use separate passwords for each user and also separate MySQL and Unix user's passwords. Otherwise, root access is granted once any web application has been breached.

Command Function
./webserver.sh Summary of command line options
./webserver.sh useradd <USER> Adds a Unix user and a MySQL user with the name <USER>. The password for both users is randomly generated and therefore must be changed prior to login.
Note: Four new directories are created in /var/www/<USER>. "html" is where your website goes. You need to configure your vHosts to point there, "files" usually is a location for files that are not directly accessed by the web server and the "root" folder can be used by the root user to place files that can't be modified by the web user, such as certificates. The folder "logs" can be used to store logs as configured in vHosts.
./webserver.sh userdel <USER> Deletes the user with the name <USER>.
./webserver.sh userpasswd <USER> Prompts for password change of <USER>.
./webserver.sh dbadd <USER> <DATABASE> Creates a database called <USER> UNDERSCORE <DATABASE> (e.g. user1_database1) and assigns it to <USER>.
./webserver.sh dbdel <USER> <DATABASE> Deletes the database <USER> UNDERSCORE <DATABASE>.
./webserver.sh dbpasswd <USER> <PASSWORD> Prompts for password change of MySQL user <USER>.
Note: This is not to be confused with the user password; The MySQL user is separate from the Unix user.
./webserver.sh reload <apache2|mysql|ftp> Gracefully restarts either apache2, mysql or ftp. If no parameter is specified, all three services are reloaded.
./webserver.sh restart <apache2|mysql|ftp> Restarts either apache2, mysql or ftp. If no parameter is specified, all three services are restarted.