Overview

These are informal notes created for personal use and for reference purposes. This is my first experience of setting up a webpage and therefore it discusses basic concepts related to website administration, website structure and available tools.

The website is running on a virtual private server (VPS) offered by bluehost.com. A VPS runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost any software that runs on that OS. For many purposes they are functionally equivalent to a dedicated physical server, and being software-defined, are able to be much more easily created and configured. They are priced much lower than an equivalent physical server. However, as they share the underlying physical hardware with other VPSs, performance may be lower, depending on the workload of any other executing virtual machines.

Setting up the account

As a new domain is created, the following information is provided to the domain owner: domain name (alexacomputing.com), account name (alexacom), passwords (set by the user) when the account is created.

Setting up the server access

A direct way to access the server is by accessing the bluehost cpanel using web interface: https://my.bluehost.com/cgi/cpanel. (You will need to login to access the cpanel). The panel can be used to configure the website, setup email, install certain standard software.

Alternatively server can be accessed using a SSH client software. Standard SSH clients are PuTTy, FileZilla, WinSCP, and other. All the listed clients are freeware (currently I am using WinSCP + PuTTy). Each connection is performed by creating a new session within the client. Each session may have different parameters. For example, you can login as a primary user or as a root (as discussed below). Configuration of the domain is also performed through the server web interface. The web interface allows to enable / disable root access to the server, install directly software from the server web interface, etc.

Setting up server privilidges

There are two levels of access: as a primary user and as a root.
  1. The primary user is assumed to access the webpage domain resources only and manage files there. The primary user has access to other files as well but access to many of them is restricted (including home/ folder, apache log files, etc. The access as a root can be enabled / disabled via the cpanel and generally shouldbe enabled only when necessary. The login as a primary user is performed as follows:
    login: account-name
    password: account-name-password
  2. The root user has access to all files and has privilidges to install software. The login as a root is performed as follows:
    login: root
    password: root-password

File permissions

To execute script files, the file permissions shall be set to readable and executable by group. The permissions can be set either using the SSH client or manually as chmod 755 file-name. Permissions are set in the order of owner/group/other users. Permission flag 7 corresponds to rwx (read/write/execute) and permission flag 5 corresponds to r-x (read/execute). Note that with the wrong permission settings the server will given an error 500 "The server encountered an internal error and was unable to complete your request."

Setting up email

Email account is creating via the cpanel. Access settings for the email account can be either secure SSL/TLS or unsecure Non-SSL. Current settings are shown below.
Setting type Incoming serverPort Outgoing serverPort
Secure SSL/TLS server.alexacomputing.comIMAP Port: 993; POP3 Port: 995 server.alexacomputing.comSMTP Port: 465
Unsecure SSL mail.alexacomputing.comIMAP Port: 143; POP3 Port: 110 mail.alexacomputing.comSMTP Port: 587

The account can be linked to Outlook desktop application or accessed through web interface (using cpanel). Current default email for contacts is alexa@alexacomputing.com.

Setting database

Software installation

Software can be installed either using cpanel or SSH client. You will need to login as a root in order to install or to run software using the SSH client. For example, to install java you login as a root and execute the following command
sudo yum install java


To test the version of installed java, execute the following command
java -version


Currently java 1.8.0_151 version is installed on 64-Build server VM. (Note that if you are logged in as a primary user, the terminal will not recognize the commands and will fail to execute them).

Running scripts

The scripts are typically located in cgi-bin folder. The executed scripts are typically either perl or bash scripts. The perl scripts start with the line

#!/usr/bin/perl -w


where -w instructs perl to turn on additional warning reporting. In the absence of the -w flag warnings will be interpreted as errors and server error 500 may be thrown. Bash scripts start with the line

#!/bin/bash


Some commands executed by the scripts are listed below
CommandDescription
cd folder-path Change current folder (for example, cd public_html/alexacomputing.com/myftp/)
java -Xms512m -jar xlloop-finance.jar Run java jar file.
ps -A|grep java Identify running java processes
ps -fC java List running java processes
kill -9 PID Kill process with a given PID (For example, for PID=11094 the command is: kill -9 11094)


Important files and locations
  1. /home/account-name/ - folder path where the webpage and webpage resourecs are located. Folder home/ has access privilidges restricted to root and cannot be accesses directly by user.

  2. /usr/local/apache/error_log - log file generated by apache server. The file is important to identify the errors in the executed cgi and other files. Acess to the folder is allowed to root user only.

  3. /usr/bin/perl - program to execute perl scripts (/usr/bin/perl5.10.1).

  4. /bin/bash - program to execute bash scripts.

  5. /bin/netstat - application to display network statistics.