Webmin Tutorial

HOW TO ADD A USER TO YOUR SERVER

    By default, your server has two user accounts; a regular user and the super user (root). To add additional users to your server, login through Webmin (https://your_ip:10000) using "root" as the username and the password that were provided on your Welcome email. The following instructions will guide you on how to set up a user and the settings required:

    1. Locate the "System" tab and click on it to see all the available options regarding your server's system. (This may vary depending on the Theme you have setup on Webmin)
    2. Find the icon titled "Users and Groups" and click on it as well.
    3. All existing users and groups shall be displayed on two different charts. Locate and click on the option "Create a new user".
    4. Now, you will be asked for the user's details, password options, group membership and creation options. Think of the username you would like to use and indicate it on the text box under "Username". The "User ID" should be left as displayed as the system selected the next available ID. This ID -must- be unique for each user or both users may access each others files.
    5. The "Real Name" is optional, so in case you would like to assign one for the user, type it on this option. If not, you may leave it blank.
    6. Home directory should be the full path to where the website files would be stored at. If no value is defined, then the system will create a directory inside the /home/ directory with the name of the username indicated.
    7. The "shell" to be used should be /bin/bash. Unless you have a preferred one, you should use this one as it's the recommended one.
    8. Regarding the password, you may set any you would like. We recommend a combination of letters and numbers for your own security.
    9. The password options is optional in case you would want for an user to be forced to change their password at a given time, set the amount of days between each change, the date the account would expire (if the account is for temporary use), the days the account may idle because it is disabled and other similar options.
    10. The "Primary group" section should have the "New group with the same name as user" option selected. Leave this option selected because it is highly recommended that both the user and group are the same. This would force the user to only edit files within its ownership.
    11. The creation options should be left as default. Click create to have your new username created on the system.
DNS

REGISTERING NAME SERVERS

    In order to have a domain name resolve to your server, you would need to create your very own name server through your domain registrar. These new name servers should be created based on the IP(s) that were assigned to you upon activation of your service.

    If for any reasons, you do not know your IP, please contact us.

    Complete instructions to registering a name server for the following registrars can be found by clicking here nameservers

      NetworkSolutions.com
      Register.com
      OpenSRS.com

SETTING UP THE DNS:

    1. Login into webmin. (https://your_ip:10000)
    2. Once logged in, click on the "Servers" tab. (This may vary depending on the Theme you have setup on Webmin)
    3. Click on "Bind DNS Server" (or "Bind 8"). Do not use BIND 4. You should then be displayed with the Global Server Options and Existing DNS Zones.
    4. Click on "Create a new master zone". On the following window, enter the domain name that you want to create it's DNS for in the "Domain name / Network" text box (For example yourdomain.com). On the "Master server", enter the primary dns server for the domain (ns.yournameserver.com) and the owner's email address in charge of administering the domain in the "Email address" text box.. To finalize, click on "Create Zone" and you be transferred back to the zone list.
    5. Click on the link for the domain you just created.

    At this moment, you have created a master record for the domain name specified using one name server. We now want to setup the secondary name server record for this domain name.

    1. Click on the new master record created for the domain you had specified and then on "Name Server (1)".
    2. Since you had already created a "master server" when you had set the master record, you can leave the "Zone Name" in blank.
    3. In the "Name server" text box enter the name of your secondary dns server with a period (.) at the end. When your click on "create" it will extract the master server previously defined and add a second record using the secondary name server specified.
    4. Make sure that the secondary name server was typed in correct and then click on "Return to record types". You already have the name server defined for this record, but you still do not have the IP set for this domain. This IP address is what the domain would resolve to.
    5. On the upper left-hand side corner, locate "Address" and click on it.
    6. You may leave the "Name" text box blank since it will be extracted as it did previously.
    7. In the "Address" text box enter the IP number you want to assign to this specific address and then click on "Create".
    8. You should now see the domain name and the IP you have assigned to it displayed under the "Add Address Record".
    9. If everything is correct, click on "Return to record types".

    What remains to do is set the aliases for your domain. You can go one by one setting them up as subdomains or you can do what we recommend the most. Setup a wildcard and have [anything].yourdomain.com resolve to the IP address as well.

    1. Since you can not use wild characters on this form, simply create a record for the time being. (You will soon edit it manually).
    2. Look for the ICON titled "Name alias" and click on it.
    3. On the "Name" text box, type in "www" and enter the full domain (yourdomain.com) with a period (.) on the end and click on "create".
    4. You should see the new created alias, but now we need to change it from being a "www" to respond to all subdomains. Click on "Return to record types" to return to the "Edit Master Zone" screen.
    5. Look for "Edit Records File" and click on it to see the actual DNS record file for yourdomain.com
    6. Search and replace "www.yourdomain.com" with an asterisk (*). The record should look like this:
      	*	IN	CNAME	yourdomain.com
      
      Note: Do not edit anything else or you may affect the actual DNS record.
    7. Click on "Save" and then on "Return to zone list".
    8. Once you are on the BIND DNS Server page, click on "Apply changes" to active the changes.

    In about 72 hours, your dns server should respond to all queries made to your domain name.

APACHE

    SETTING UP A NAME BASED VIRTUAL SERVER

    Time to setup a virtual server. You must first decide whether you would be setting up a secure website as well, since this would require a different setup. First, we will discuss how to setup a name-based virtual host:

    1. Login to Webmin.
    2. Once you have logged in, click on the "Servers" tab to view all the services provided.
    3. Locate the "Apache Webserver" icon and click on it.
    4. You should now be displayed with the "Global Configuration" and all pre-defined virtual servers would be listed as well under "Virtual servers".
    5. Browse down the that page to locate the "Create a New Virtual Server" section.
    6. On "Handle connections to address", select "Any address". Make sure that "Add name virtual server address (if needed)" is checked as well as "Listen on address (If needed)" as well.
    7. Decide where you would like to have your website files on the server and defined them under "Document Root". The default method directory where all website are located is "/var/www/". For your own convenience, inside the /www/ directory, there are six folders which can be used as templates. The path to each one would be /var/www/website1/ and so on. You may also use the browse button [...] to browse to the directory of your preference.
    8. The "Server Name" would be the domain name that you are setting Apache for.
    9. All other options may be left as they are. Click on "Create" to add this new domain to the Apache configuration file.

    Additional add-ons:

    You might also want to setup options for the directories. Click on the virtual server you have just created and browse down to the "Create Per-Directory, Files Or Location Options".

    1. Set the option for the directory by selecting "Directory" on "Type" and "Exact match" as the regular expression (regexp). On the path, type in the full path to your website's files. You may use the browse [...] button to navigate to it. Once you have created, click on the icon displayed for it to edit it's properties. On the "Per-Directory Options" click on "Edit Directives" and add the following and click on save once finished.

      		Options ExecCGI
      		Options +Includes
      		AllowOverride All
      
    2. Click on "User and Group" to define the way CGIs programs will run on the server. It is recommended that it is set to run as a specific user and group. You may enter the user you had created before, or browse it using the [...] button and save it.

    3. Now, create an alias for the cgi-bin by clicking on the "CGI Programs" icon. Enter /cgi-bin/ on the "CGI Directory aliases" option on the "From" field. The "To" field should be the path to where the cgi-bin will be placed within the directory of the website's files.

    After you have made the above, click on "Apply Changes" and your new virtual host should be created.

    Knowing the procedure on how to setup a Virtual Host, you can now proceed to setting up a secure website. The following steps will guide you on how to do so:

    1. Browse down the page to locate the "Create a New Virtual Server" section.
    2. On "Handle connections to address", select "Any address". Make sure that "Add name virtual server address (if needed)" is checked as well as "Listen on address (If needed)" as well.
    3. Decide where you would like to have your website files on the server and defined them under "Document Root". The default method directory where all website are located is "/var/www/". For your own convenience, inside the /www/ directory, there are six folders which can be used as templates. The path to each one would be /var/www/website1/ and so on. You may also use the browse button [...] to browse to the directory of your preference.
    4. The "Server Name" would be the domain name that you are setting Apache for along with port 443. An example would be mydomain.com:443
    5. All other options may be left as they are. Click on "Create" to add this new domain to the Apache configuration file.
    6. Once you have been returned to the Global Configuration page, browse up the page and click on "Apply changes" for your new virtual host to take effect on the server.

MYSQL

    SETTING UP DATABASES

    1. Log into Webmin
    2. Click on the "Servers" Tab and then click on "MySQL Database Server" option. On the following screen, you would see your existing databases. Since you probably do not have none, you should see pre-existing databases created.
    3. Click on "Create a new database" to create your first database.
    4. Enter your database name and if you prefer, you can set an initial table and set the structure for it and click on "Create".
    5. You should now see the new database created on under the MySQL Databases list. Click on the new database to start building your tables.
    6. Define the amount of fields you want to create on your table and click on "Create a new table". The default number of fields is four.
    7. State the name of the table on the first text box and you have the option if you want to copy fields over from another table. If not, then is no problem.
    8. The type by default is "MyISAM", so there is no need in changing it.
    9. Specify the type of data fields your table would require by specifying it on the under "Initial fields".
    10. Once you click on "Create", you will go back to the "Edit database" window which will display your new created table.
    11. If you click on the table, you can then continue to add more fields that your table may require and indicate the types and values for each. You may also click on "View Data" to add records to the table.
    12. Enter new table records, delete existing records, or edit existing records.
    13. Click on "Return to database list", once you have finished.
    14. Now, MySQL uses its own users so it is recommended that you create this table (if it isn't created already.
    15. Click on "mysql" database, and then on the table "user".
    16. You will be displayed the structure of this table and in order to set a new entry, click on "View Data".
    17. On this table, all the users authorized to access mysql will be listed along with the their privileges defined. Click on "Add row" to add your new user to this table.
    18. Enter a hostname (either specify localhost or the actual hostname of your dedicated server). This should limit the connections from this user is to be made from within the server, not from the outside). The permission set here will define what that specific user can and can not do. Assign each privilege carefully. Repeat this for every user you wish to add.
    19. Now that we have the users setup, we need to set the privileges to the database(s). Click on "Return to table list" and then click on "db".
    20. On the next screen, click on "View Data" and then on "Add row". The "Host" is defined by "%" since that would set the database may be accessed from anywhere. If you want to limit to avoid external connections, then you should only use "localhost". Set the permission for the database and once it has been saved, remember to verify that they are correct.
    21. For extra security, use the "Host" table to set privileges on access to the specific database as well.