JSP and Java Servlets
Telnet & SSH
FTP
.htaccess Files
Password Protected Directories
Custom Error Messages
Redirection
Restricting Content
PHP Configuration
.htaccess
File Types
CRON
JSP AND JAVA SERVLETS
Directory Structure:
Before you activate the Tomcat server for a domain, Make these
directories and files in the root directory of your domain (case
sensitive):
/WEB-INF/
/WEB-INF/classes/
/WEB-INF/lib/
/WEB-INF/web.xml
The web.xml is an XML file describing the servlets and other
components that make up your application, along with any
initialization parameters and container-managed security constraints
that you want the server to enforce for you. A basic web.xml file
can be found HERE
/WEB-INF/classes/ is where any Java class files are located. If your
classes are organized into Java packages, you must reflect this in
the directory hierarchy.
For example, a Java class named 'com.mycompany.mypackage.MyServlet'
would need to be stored in a file named: /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.
/WEB-INF/lib/ contains JAR files that contain Java class files (and
associated resources) required for your application, such as third
party class libraries or JDBC drivers.
More information can be found HERE
Tomcat Manager
To activate or remove the Tomcat server from a domain, go to Tomcat
Manager under Account Details on the control panel.
The tomcat server is restarted at midnight every day. This is when
any changes will take effect.
Reloading
You may need to reload the Tomcat server on a domain if you make
changes to your class files or web.xml. This can be done from the
Tomcat Manager on the control panel. Choose your domain from the
list, make sure Reload is selected and click Next Step. The reload
is instant.
TELNET &
SSH
To log in to your server, you must use the SSH2 protocol. This is a
secure version of Telnet that uses encryption.
For security reasons, all IP addresses are denied SSH access on our
servers. To use SSH, you will need to send us a support request
asking to be enabled for this service.
Once enabled, an 'SSH MANAGER' option will appear on the Web Tools
page of your control panel. This tool allows you to enter your IP
address(es) into the system, which will then unblock them.
Please note: For security reasons, these IP addresses will be
flushed every night at round 4am.
Never leave your account's home directory when you are in Telnet/SSH
as this breaks our terms and conditions.
Telnet Client
If you do not have a Telnet client that supports SSH2, you can
download one below:
http://www.controlpanel.cc/putty.exe
The login details you need to use are:
Protocol: SSH2
Hostname: username.dns-systems.net
Telnet Commands
Listed below are some basic Telnet commands:
• ls - This is like typing 'dir' in DOS. It displays files in the
current directory.
• pwd - Tells you which directory you are currently in.
• cd directoryname - Changes into the specified directory.
• cd .. - Moves out of the current directory.
• unzip filename.zip - Unzips a ZIP file into the current directory.
• vi file.txt - VI is linux's version of notepad. For more help,
look Here
• logout - Logs out of the server.
FTP
FTP (file transfer protocol) is the main method of up loading files
to you web space, it can also be used to make directories etc. Every
account comes with at least one FTP login and password, this is the
same as you use to login to the control panel.
To FTP into your account you will first need to get a copy of an FTP
program, we recommend Cute FTP, which you can get from
www.cuteftp.com. To set up you FTP client you will need to give it
some information about our server, this information is listed below:
Username & Password - This is the same as you choose when you
started the account and you will find it in your welcome e-mail.
Host name - username.dns-systems.net or you can use any domain on
our system by just entering yourdomian.com (no http://). If you
would like to have personal ftp server address ie ftp.yourdomain.com
then just make the subdomain ftp for the domian you would like the
personal ftp.
Host Type - All our servers are Unix based, running Linux operating
systems.
HTACCESS FILES
You can use a file called .htaccess which is used to change
properties of directories on your web-site, such as password
protecting them, redirecting people to other addresses, or creating
custom error messages.
.HTACCESS: PASSWORD PROTECTED DIRECTORIES
1. Make a text file called htaccess.txt in notepad and put the
following lines in it:
AuthUserFile /home/username/directoy id/path to directory/.htpasswd
AuthName "My secret area"
AuthType Basic
require valid-user
The top line is the path to the directory you want to password
protect. You will need to change the 'username' and 'directory id'.
You can find this information on the Account Details page on the
control panel.
The .htpasswd contains usernames and passwords, we will create this
a bit later.
The "My secret area" text can be anything you want. It will be
displayed in the password box when someone tries to access the
protected area of the site.
2. Make another text file called htpasswd.txt in notepad and put the
following lines in it:
username:password
'username' is the username you want to use, and 'password' is the
encrypted password. You can encrypt your password by going to
http://www.controlpanel.cc/password.php and copying the encrypted
text into your htpasswd.txt file.
You can have as many username:password lines as you want.
3. Upload the two files to the directory that you want passworded.
Rename the text files to .htaccess and .htpasswd in your ftp
program.
When you go to the web-site, a password window should now appear.
.HTACCESS: CUSTOM ERROR MESSAGES
Make a text file called htaccess.txt and enter the following text
into it:
ErrorDocument 404 /notfound.html
'404' is the error number (404 means: file not found) and '/notfound.html'
is the custom error html document. Upload the file into the
directory you want the redirect to work in, then rename it to .htaccess
.HTACCESS: REDIRECTION
Make a text file called htaccess.txt and enter the following text
into it:
Redirect / http://www.other-site.com
Change 'http://www.other-site.com' to the URL you want the user to
be directed to. Upload the file into the directory you want the
redirect to work in, then rename it to .htaccess
.HTACCESS: RESTRICTING CONTENT
Prevent directory listing
Put the following into a .htaccess file to stop people viewing a
directory on your web-site. They will still be-able to access
individual files:
Options -Indexes
Restricting access for certain IP addresses
Put the following into a .htaccess file to block IP's from your
entire site or directory. Replace the IP addresses with your own
values:
Order Allow,Deny
Deny from 111.111.111.111 222.222.222.222
Allow from all
.HTACCESS: PHP Configuration
There are two settings you can put into a .htaccess file that allow
you to change certain PHP INI settings:
php_value - Used to set a string PHP INI directive. For example:
'/path/to/mydir/'
php_flag - Used to set a boolean PHP INI directive. For example:
'On' or 'Off'
EXAMPLES:
php_value include_path /usr/local/lib/php
php_flag register_globals On
.HTACCESS: File Types
You can alter the way certain files are handled using a .htaccess
file. Some examples are below:
ForceType
The ForceType directive will tell the web-server to treat all files
in the current directory as one mime-type. For example, to treat all
files in the current directory as PHP files, use the following:
ForceType application/x-httpd-php
AddType
The AddType directive allows you to add new mime-types or alter
mime-types for different file extensions. For example:
AddType image/gif .gif
AddHandler
You can use the AddHandler directive to create a cgi-bin directory
anywhere in your web-space. The following example will alter the
current directory to be a cgi-bin directory:
Options +ExecCGI
AddHandler cgi-script cgi pl
For more information regarding the ForceType and AddHandler
directives, Click Here
CRON TUTORIAL
Cron allows you to run a program or script at certain times, for
example: every 10 minutes or once a day.
Kunal Kapoor has very kindly written a Cron tutorial based around
our system.
CLICK HERE to download the
tutorial (800k). |