Getting started with a POWER web hosting plan

Find out how to get started with a POWER Web Hosting plan

Last updated 4th February 2021

Objective

You've subscribed to a Web POWER web hosting plan to deploy Node.js, Python or Ruby applications, and you want to begin developing your project.

This guide will explain how to manage your POWER web hosting using the OVHcloud Control Panel and the OVHcloud APIs.

Find out how to get started with a POWER web hosting plan.

Requirements

Instructions

From the OVHcloud Control Panel

The POWER web hosting management UI is in the Web Cloud section, under Hosting plans in the sidebar.

From the OVHcloud Control Panel

FTP - SSH access

At the activation of your POWER web hosting plan, we have sent you an email with the SSH and FTP credentials. You can also manage them from the FTP - SSH tab.

FTP - SSH access

You will find detailed information on this topic in our SSH guide.

Adding a domain name

For default, your POWER web hosting plan is attached to a generated URL. In order to use your own domain name, you can add it in the Multisite tab.

Adding a domain name

You will find detailed information on this topic in our Hosting multiple websites on your Web Hosting plan guide.

Using a database

Your POWER web hosting plan includes databases. They can be accessed from the Databases tab.

Using a database

You will find detailed information on this topic in our Creating and managing a database in your Web Hosting plan guide.

Accessing logs and statistics

Web server logs and website statistics are included in your POWER web hosting plan,under the Statistics and logs tab.

Accessing logs and statistics

You will find detailed information on this topic in our Accessing a website’s logs and statistics on a Web Hosting guide.

Node.js

Hello World in Node.js

Let's suppose you have the default configuration for Node.js hosting:

  • Runtime: nodejs 14
  • Entrypoint: index.js
  • DocumentRoot: www

To verify your configuration, you can use the Retrieve active configuration API endpoint.

Connect via SSH to your POWER web hosting, go to the www folder and create an index.js file there:

index.js

const http = require('http');
const port = 3000;
const msg = `Hello World from NodeJS ${process.version}\n`;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end(msg);
});
server.listen(port);
~ $ vi www/index.js
const http = require('http');
const port = 3000;
const msg = `Hello World from NodeJS ${process.version}\n`;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end(msg);
});
server.listen(port);

~ $ mkdir -p www/tmp
~ $ touch www/tmp/restart.txt

Then restart your instance.

Hello World in Node.js

Python

Hello World in Python

Let's suppose you have the default configuration for Python hosting:

  • Runtime: Python 3.7
  • Entrypoint: app.py
  • DocumentRoot: www

To verify your configuration, you can use the Retrieve active configuration API endpoint.

Connect via SSH to your POWER web hosting, go to the www folder and create an app.py file there:

app.py

import sys

def application(environ, start_response):
    status = '200 OK'
    output = '\n'.join(['Hello World!', f"Version : {sys.version}",
                        f"Executable : {sys.executable}"])

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]    

Then restart your instance.

Hello World in Python

Ruby

Hello World in Ruby

Let's suppose you have the default configuration for Ruby hosting:

  • Runtime: Ruby 2.6
  • Entrypoint: config.ru
  • DocumentRoot: www

To verify your configuration, you can use the Retrieve active configuration API endpoint.

Connect via SSH to your POWER web hosting, go to the www folder and create a config.ru file there:

config.ru

require 'socket'
require 'timeout'

class Application

    def call(env)
        msg = "Hello World from ruby #{ RUBY_VERSION }p#{ RUBY_PATCHLEVEL }"
        [200, { "Content-Type" => "text/plain" }, [msg]]
    end
end

run Application.new

Then restart your instance.

Hello World in Ruby

From the API

This tutorial presupposes that you already have some familiarity with the OVHcloud APIs. If you want to know more on this topic, please look at the First Steps with the OVHcloud APIs guide.

The OVHcloud APIs currently available for POWER hosting plans are:

List available configurations

Retrieve active configuration

Modify active configuration

This endpoint allows you to modify your configuration parameters, for example your entry point.

Restart the service

Setting up a redirection from HTTP to HTTPS

You can create an .htaccess file in your POWER web hosting root folder (usually www) to set up a redirection from HTTP to HTTPS:

RewriteCond %{ENV:HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
~ $ cd www
~/www $ vi .htaccess
RewriteCond %{ENV:HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Restart your instance

Each time you modify your application, you should tell the server to restart it.

In your document root you should touch the file tmp/restart.txt.

~ $ cd www
~/www$ mkdir tmp
~/www$ touch tmp/restart.txt

As this operation is performed on SSH server, you may need to wait before the web server notices your changes (max. 30 seconds).

Go further

Accessing a web web hosting plan via SSH

Hosting multiple websites on your Web Hosting plan

Creating and managing a database in your Web Hosting plan

Accessing a website’s logs and statistics on a Web Hosting

Join our community of users on https://community.ovh.com/en/.

Join our Gitter room to discuss directly with the POWER Web Hosting team and the other users of this lab.


Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community

In accordance with the 2006/112/CE Directive, modified on 01/01/2015, prices exclude VAT. VAT may vary according to the customer's country of residence.