servlet hosting logo
Contact us: +44 (0) 1491 413606 - contact@nameonthe.net
Members of
Members of Nominet Ripe member WorldPay Guarantee
We accept the following payment methods:
Visa payments supported by WorldPay Visa/Delta payments supported by WorldPay Visa/Electron payments supported by WorldPay Mastercard payments supported by WorldPay Switch payments supported by WorldPay JCB Solo payments supported by WorldPay
Virtual Private Server Guide
Upon account setup a Virtual Private Server (VPS) account will have been preconfigured with Tomcat, Mysql, Proftpd, Apache and ssh. This guide presents a guide to using the VPS to manage and deploy web applications. As the VPS appears and behaves like a dedicated linux server virtually all Linux commands will work as expected, the exceptions are low level commands such as installing modules and re-compiling the kernel.
Logging In
SSH (Secure Shell) access has become the de facto standard for remote administration of Un*x based servers replacing telnet which has major security implications (passwords are passed in eh clear). Most modern Unix and Mac based workstations will have a ssh client pre-installed, for Windows systems 'putty' is a very popular open source ssh client, freely available to download here: http://www.chiark.greenend.org.uk/~sgtatham/putty/. To connect to the VPS account using putty the username, password and host address will need to be specified. Upon initial login the username will be 'root' (equivalent to the Window's superuser) and the host address and password will have been provided with the set up details. Once logged in successfully the server will provide a prompt which will appear as below:
root@hostname:~#
Managing Services
Upon acount creation the VPS will have a set of services installed which provide functions for running and managing web applications. Mysql, Apache, Proftpd, Tomcat and SSH are installed by default which provide respectively database, web server, ftp server, servlet container and ssh remote access functionality. Scripts to control these applications are installed in /etc/init.d (a well established Unix practice). To execute a script issue this command from the command line (having logged in as above), if no parameters are given the script will provide a usage message.
root@hostname:~# /etc/init.d/tomcat start
Special care must be made to not stop the ssh service as stopping this process will make the server unreachable via ssh and will require technical support to intervene. To determine the status of a service the 'status' parameter can be given, alternatively the 'ps ax' command lists all running processes within the system. The ps command is incredibly powerful and a number of different options can be given to affect its behaviour, for example to find all java processes the -C option can be used, i.e. 'ps -C java'.
Managing Tomcat
Tomcat will be installed within /usr/local/tomcat and will be configured to work in conjunction with Apache (using the mod_jk connector). It will also be preconfigured with any hosts that were requested when the account was setup. The core configuration file can be found here /usr/local/tomcat/conf/server.xml. It is recommended that before editing the server.xml that a backup be taken so that any errors introduced can be rapidly rolled back by restoring the original. Taking a copy from within the /usr/local/tomcat directory (type 'pwd' in the shell to determine where you are in the filesystem) can be achieved by issuing the following command: cp conf/server.xml conf/server.xml.bak. Tomcat will need to be restarted for any changes in the server.xml to take effect. The logs diretory within /usr/local/tomcat provides very useful detail if Tomcat refuses to start after modification of the server.xml, it is suggested that the 'tail' command be used to track the progress of Tomcat, for example having two shell sessions open with one used to restart tomcat (/etc/init.d/tomcat restart) and the other tracking the core tomcat log file using the tail command (tail -f logs/catalina.out). To break out of the tail command use Control+C. Tomcat also ships with an 'admin' app which provides a web based administration tool to simplify the management of Tomcat which is enabled by default and visible using the following url: http://www.yoursite.com/admin, the credentials (username / password) to connect are specified in /usr/local/tomcat/conf/tomcat-users.xml, it is recommended that the default username / password (admin / admin) are changed.
Managing Web applications
The convention is for web applications/sites to have document roots within the /web directory following the naming convention depending on the name of the site, for example www.mysite.com's document root would be /web/www.mysite.com. The 'document root' is the directory which corresponds to resources appearing with a leading /, i.e. http://www.mysite.com/myresource.html would equate to a mysource.html file within /web/www.mysite.com, similarly http://www.mysite.com/dir/myresource.html would appear in the /web/www.mysite.com/dir directory. Deployment of web applications is simply a case of uploading a .war file into the document root of the site you wish it to be deployed under relying on Tomcat's auto-deployment mechanism. Note, auto-deployment and static configuration of webapps (as seen below with the ROOT context) cannot co-exist, for example if you have a ROOT context - a special context which is deployed at the root of the site, i.e. http://www.mysite.com/ - and try to deploy a ROOT.war (special name for .war files which are deployed as the ROOT context) with a ROOT Context defined as below then the ROOT.war will not be deployed, you will need to remove the staticly defined Context and restart Tomcat.
Uploading Content
FTP is activated by default on VPS accounts, although we strongly suggest using a secure alternative such as SCP. Clients exist for virtually all known operating systems, a popular freeware Windows product is 'winscp'. Note. You will not be able to upload content as 'root' using FTP, a non-root account will need to be created - see Managing user accounts.
Adding new hosts
After checking that the new host's ip address matches the IP address of your virtual server adding new hosts is relatively simple. Configuring tomcat for a new host involves editing the server.xml and adding a 'Host' element (use an existing element as a template) within the 'Engine' xml element, a typical Host entry appears below:
<Host name="www.mysite.com" unpackWARs="true" appBase="/web/www.mysite.com">
  <Context path="" docBase="/web/www.mysite.com" reloadable="true" />
</Host>
As Apache and Tomcat are integrated Apache also needs to be configured to recognise a new host, Apache is installed within the /usr/local/apache2 directory, a feature of Apache is that the configuration can be split into individual files which is used in the VPS's configuration. The conf/sites directory (inside apache's home directory - /usr/local/apache2) contains files relating to each configured domain. Continuing with the www.mysite.com example above, a file named www.mysite.com would be visible within the /usr/local/apache2/conf/sites directory (note the actual name of the file in the conf/sites directory has no actual bearing, it is purely based on convention). Viewing the file using the 'vi' editor would reveal the following content:
<VirtualHost 217.207.14.225:80>
  DocumentRoot /web/www.mysite.com
  ServerName www.mysite.com
  JkMount /* accountname
</VirtualHost>
The DocumentRoot and the ServerName relate to (respectively) the docBase and the name within the section of the server.xml outlined above. The JkMount states that all resources (/*) shall be forwarded to Tomcat, if you wanted only *.jsps to be forwarded to Tomcat you would use a JkMount /*.jsp directive, multiple JkMount directives can be used. The IP address will need to match the ip address allocated to the VPS account outlined within the email send to you upon account creation. This contains the most basic configuration for a host, for inexperienced users it is recommended that an existing host configuration file be used as a template. After creating a new conf file for the new host Apache's configuration can be verified using the /etc/init.d/apache configtest command. Once verified restart apache using the /etc/init.d/apache restart command. For a comprehensive outline of apache's configuration the http://httpd.apache.org website provides full details of all available directives, alternatively if there is a setting you require changing please contact technical support who can make this for you.
Managing Mysql
As with the other services mysql can be controlled using the /etc/init.d/mysql script, to stop and start mysql the following commands would be used: /etc/init.d/mysql stop -> /etc/init.d/mysql start To connect to the mysql server from the command line the 'mysql' command can be used, a typical invocation would be 'mysql -p', the password will have been set to the password supplied with the account details. To return to the normal shell type 'exit'. All commands need to be terminated by a semi-colon (;). For comprehensive details of mysql system administration the www.mysql.com site has a thorough user manual. A list of common commands for database adminstration follow:
Create database;
mysql>create database [databasename]
Show existing databases;
mysql>show databases
Connect to an existing database;
mysql>use database [databasename]
Make a user and grant permissions to a database
mysql>grant all privileges on databasename.* to username@'%' identified by 'password';
Flush (make active) any permission changes
mysql>flush privileges;
Managing user accounts
In many circumstances it may be useful to have multiple users connecting to the server who perform separate tasks according to their remit, the most common being able to update an individual website. It is strongly advised that the 'root' password is not distributed to normal users as this has unlimited access and accidents could potentially remove all files from your VPS, instead it is suggested that non-privileged users be created for this purpose. The adduser command can be used to create new users, by default the home directory for new users will be /home/newusername. To change the password the 'passwd' command can be used, if issued without an option then the password for the current user will be changed. When logged in as the 'root' user it is possible to change the password on the system for any user. In many circumstances it is very useful to change the home directory of a particular user to the doucment root for a site (as defined above). This can be carried out during the account creation stage using the -d option, i.e. adduser -d /web/www.sitename.com username or by editing the /etc/passwd file and changing the last element (colon delimited) which represents the home directory for the user's entry. If the later option if chosen it will be necessary to change ownership of the files or the user will not be able to make any changes to their home directory, this can be done using the chown command - chown -R /home/www.sitename.com username (the -R makes the command recursive).
Managing email accounts
Email management can be performed by logging in to the www.nameonthe.net admin page from any page within www.nameonthe.net
Installing third party software
It is recommended that third party software be unpacked within /usr/local/src. All hosting software with the exception of tomcat has been installed from source so it is possible if required to recompile and install software with additional features compiled in if required.
Getting help
If you experience problems which you cannot resolve then please contact technical support who can assist you in configuration matters - support@nameonthe.net - This guide is also available when logged in via the 'man vps' command.
username
password
>> Login <<
Latest Java news
System Status
(Sun Feb 05 06:06:28 GMT+00:00 2012)
There are no known network or server problems

Valid XHTML 1.0!

Valid CSS!

Copyright © www.nameonthe.net 1999-2008, All Rights Reserved
All prices exclude VAT