title | excerpt | updated |
---|---|---|
Getting started with a POWER web hosting plan |
Find out how to get started with a POWER Web Hosting plan |
2021-02-04 |
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.
- one of the 3 POWER web hosting plans: Node.js, Python or Ruby
- access to the OVHcloud Control Panel
The POWER web hosting management UI is in the Web Cloud
{.action} section, under Hosting plans
{.action} in the sidebar.
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
{.action} tab.
You will find detailed information on this topic in our SSH guide.
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
{.action} tab.
You will find detailed information on this topic in our Hosting multiple websites on your Web Hosting plan guide.
Your POWER web hosting plan includes databases. They can be accessed from the Databases
{.action} tab.
You will find detailed information on this topic in our Creating and managing a database in your Web Hosting plan guide.
Web server logs and website statistics are included in your POWER web hosting plan,under the Statistics and logs
{.action} tab.
You will find detailed information on this topic in our Accessing a website’s logs and statistics on a Web Hosting guide.
Let's suppose you have the default configuration for Node.js hosting:
- Runtime: nodejs 14
- Entrypoint: index.js
- DocumentRoot: www
[!primary]
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.
Let's suppose you have the default configuration for Python hosting:
- Runtime: Python 3.7
- Entrypoint: app.py
- DocumentRoot: www
[!primary]
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.
Let's suppose you have the default configuration for Ruby hosting:
- Runtime: Ruby 2.6
- Entrypoint: config.ru
- DocumentRoot: www
[!primary]
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.
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:
[!api]
@api {v1} /hosting/web WE /hosting/web/{serviceName}/availableConfigurations
[!api]
@api {v1} /hosting/web WE /hosting/web/{serviceName}/configuration . This endpoint allows you to verify your configuration parameters, for example your entry point.
[!api]
@api {v1} /hosting/web WE /hosting/web/{serviceName}/configuration
This endpoint allows you to modify your configuration parameters, for example your entry point.
[!api]
@api {v1} /hosting/web WE /hosting/web/{serviceName}/attachedDomain/{domain}/restart
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]
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
[!primary]
As this operation is performed on SSH server, you may need to wait before the web server notices your changes (max. 30 seconds).
Accessing a 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 Discord on our web-hosting-power channel to discuss directly with the team and other users of this lab.