WebFaction Smarter Web Hosting   WebFaction Smarter Web Hosting
WebFaction Plans and Prices       WebFaction Signup       WebFaction Why WebFaction?

    Support sites:   Documentation   |   Forum   |   Control panel   |   Status blog   |   Tickets

Table Of Contents

Previous topic

Domains

Next topic

Example Websites

PDF download

Download this document as PDF

Applications and Websites

The WebFaction web hosting system works by keeping track of three import components of your account:

  • domains – domain names, like example.com (see Domains)
  • applications – a collection of directories, files, and processes used to serve data
  • websites – a record used in our system to determine which URLs should be served by which applications (see A Sophisticated Website Configuration)

In this section of the user guide, you will learn how to assemble domain names, applications, and your files into a complete website that your visitors can reach and use.

See also

The next chapter of the user guide, Example Websites, demonstrates common use cases.

Applications

To serve content, run code, and interact with databases, you need applications. Applications are collections of directories, files, and system settings which allow media to be served and code to be executed by the web server.

For example, an application could be as simple as a Static-only application storing a handful of HTML files and some JPEG images. In contrast, however, applications can be sophisticated software tools, like a Django application or the WordPress blogging engine. You can even run a Custom app (listening on port) to use software not covered by one of WebFaction’s one-click installers.

The control panel allows you to manage applications installed on your account. You can install a wide variety of applications, including:

  • AWStats
  • CherryPy
  • Django
  • Drupal
  • Passenger
  • Pylons
  • Python (Apache with mod_python or WSGI)
  • Ruby on Rails
  • Static-only
  • Static/CGI/PHP
  • Subversion
  • Trac
  • TurboGears
  • Webalizer
  • WebDAV
  • WordPress
  • Zope

You can also create a custom application, which lets you listen on a specified port.

When you create an application with the control panel, a directory is created in your home directory – $HOME/webapps/<app name>, where <app name> is the application name you entered on the control panel – along with any required files, like .htaccess or included scripts. If the application is a long-running process, the control panel installer also adds a cron job which periodically restarts the process if it stops running.

Note

An application cannot be reached from outside a WebFaction server without being configured in a website entry with the control panel. You’ll learn more about configuring website entries in the Websites section.

Create an Application with the Control Panel

To create an application with the control panel:

  1. Log in to the control panel.

  2. Click Domains / websites ‣ Applications. The > Home > Apps page appears.

  3. Click the Add new (add new) button. The> Home > Apps > Add page appears.

    _images/app_add.png
  4. Enter a name for the application in the Name field.

  5. Select an application from the App category menu.

  6. Optional: To use a version of the application other than the latest, in the App type menu, click to select the version of the application you want to use.

  7. Review the App doc information about the selected application.

  8. If applicable, enter any required information in the Extra info field.

  9. Click the Create button.

Installing Applications Not Listed in the Control Panel

If an application or a specific verison of an application you want to use is not listed in the control panel, don’t despair. First, check out WebFaction Software Documentation, where we provide instructions for additional software packages not covered by a control panel installer. You can also install custom applications using one of the three “generic” application types:

  • Static/CGI/PHP: If the software you want to use can run directly from the document root directory, like many PHP software packages, use a Static/CGI/PHP application. Once you’ve installed the application, upload files to ~/webapps/static_app, where static_app is the name of the application, to get started.

  • Symbolic link to static/cgi/php: If the software you want to use needs only a subset of its files exposed to the web, use a Symbolic link to static/cgi/php application. In the control panel installer, enter the absolute path to the directory you want to expose to the web in the extra_info field. Otherwise, it works just like a Static/CGI/PHP application.

  • Custom app (listening on port): If the software you want to use listens on a network port, use a Custom app (listening on port). A Custom app assigns a specific port number where incoming traffic will be directed. Install the software, configure it to listen to the specified port, and run.

If you need to repeatedly install an application not provided by the WebFaction control panel, see the WebFaction API documentation.

Websites

An application by itself isn’t particularly useful: it needs a web address—a domain name and a path—so it can be reached by a web browser. A website entry in the control panel is needed to connect an application to a domain and path.

Once you’ve configured at least one domain and one application, you can create a website record in the control panel. A website entry in the control panel connects domains to applications. A website entry works to instruct your WebFaction web server to forward requests for a specific URL path to an application and then return the application’s response.

The Life Cycle of a Request and Response

Requests to a URL path are received by a WebFaction server’s frontend process (typically an instance of the nginx web server). Such requests are proxied to a specific application’s process, such as a Django application’s instance of the Apache web server. The frontend process waits for a response from the application and forwards that response to the source of the original request.

Please see the diagram below for a closer look at how requests are received and replied to in a WebFaction server.

An illustration of how requests are handled by a WebFaction server

For example, suppose you have a Drupal application, my_drupal, and a domain, mysite.com. A website will let you configure mysite.com to point to your application, my_drupal. Then, when a visitor to your site enters http://mysite.com/, your Drupal application will load at that URL. Behind the scenes, the WebFaction web server automatically proxies requests received for mysite.com to the application stored at $HOME/webapps/my_drupal.

Hint

Creating a new site, but haven’t decided on a domain name yet? Or maybe you want to test the latest and greatest version of your site before taking it live on your existing domain name? Create subdomains of your username.webfactional.com domain to connect to your applications instead (like testsite.username.webfactional.com). See Adding a Domain to the Control Panel for more information.

Websites permit much more sophisticated configurations, however. You can configure a specific path (or mount point) at a domain to point to an application, allowing you to run multiple applications under a single domain. For example, suppose you have a pair of applications, a Drupal application called my_drupal and a Static/PHP/CGI application containing phpBB called forum, and a domain, mysite.com. You can configure a website to serve my_drupal from the root path (/) of mysite.com and forum from /forum:

mysite.com
    /       ->  my_drupal
    /forum  ->  forum

Domain and path combinations and applications may have a many-to-one relationship. While a particular domain and path combination can only point to one application, numerous domain and path combinations can point to the same application.

Create a Website with the Control Panel

To create a Website record with the control panel:

  1. Log in to the control panel.

  2. Click > Domains / websites ‣ Websites.

  3. Click the Add new button. The > Home > Sites > Add page appears.

    _images/website_add.png
  4. Enter a website name in the Name field.

  5. If applicable, click to select an IP address where this site will be reached from the Ip menu.

  6. If you want your site to reachable over a secure HTTPS connection, click to select Https.

  7. Click to select the domains which correspond to this website record from the Subdomains field. Hold Ctrl or Cmd to select multiple domains.

  8. Add as many applications as desired:

    1. Click the Add new button. An App and URL path field appear.

      _images/website_add_app_add.png
    2. Click to select an application from the App menu.

    3. Enter a path in the URL path field.

  9. Click the Create button.

As soon as the changes take effect, you can access each application at the URLs specified in the URL path field.

Note

Changes to website entries can take up to two minutes to take effect. If at first a new or modified website is not working as expected, please wait at least two minutes and try again.

Secure Sites (HTTPS)

You can configure a website record to use HTTPS, an encrypted alternative to a normal HTTP connection.

Note

The HTTPS setting is either on or off. Connections will only be accepted for that website entry over the protocol specified. If you need your site to be available over HTTP and HTTPS you will need to create two website records.

By default, HTTPS websites use WebFaction’s security certificate. On some browsers, this can result in an alert to users that your domain does not match the security certificate. If you would like to use your own certificate, you will need to purchase the certificate through a certificate authority. You will also need to add a dedicated IP address to your account; please open a ticket with WebFaction support for details.

If you already have your own certificate, please upload your certificate and key files to your home directory. Then, open a support ticket to request that the certificate be enabled.

Generating a Certificate Signing Request

If you are purchasing your own security certificate, you will be asked to provide a Certificate Signing Request (CSR). To generate a CSR:

  1. Open an SSH session to your account.
  2. Enter openssl genrsa -out domain.key 2048, where domain is your domain (for example, mydomain.com), and press Enter. A new file, domain.key, is created.
  3. Enter openssl req -new -key domain.key -out domain.csr and press Enter. Several prompts for details about the certificate will appear. When prompted for a Common Name, be sure to correctly enter the domain (or subdomain) for use with the certificate. When openssl is finished, the CSR file, domain.csr, is created.
  4. Enter more domain.csr and press Enter. The contents of your CSR file will appear in the console.
  5. Copy and paste the contents of your CSR file to your certificate provider’s form.

Reviewing Logs

You have complete access to your websites’ and applications’ logs in your home directory. You will find logs in your $HOME/logs directory, named according to the websites’ names the control panel.

See also

To generate statistics based on log files, see Webstats.