King's Domain Logo

King'sDomain

Web Server Overview

Our Web Hosting service provides you with a powerful, pre-configured server running Nginx, a professional-grade web server. This setup is designed to be both flexible for beginners and powerful for advanced users, featuring a rich set of tools right out of the box.

Key Features:

  • Nginx: A high-performance web server for speed and reliability.
  • PHP Support: Full support for PHP versions 8.0 through 8.4, allowing you to run dynamic websites and frameworks.
  • Cloudflare Tunnel (HTTPS/SSL): Mandatory for connecting your domain. This provides a free SSL certificate, robust DDoS protection, and hides your server's IP address for maximum security.
  • Git Deployment: Automatically deploy your website directly from a GitHub or GitLab repository.
  • Composer: PHP dependency manager is pre-installed for managing your project's libraries.
  • Optional WordPress: A one-click installation option for the world's most popular CMS.
  • Cronjob Engine: An internal scheduler for running automated tasks (e.g., maintenance scripts).

Connecting a Domain & Enabling HTTPS (SSL)

To make your website accessible to the public, you must connect it to a domain name. We enforce the use of Cloudflare Tunnels, a free and highly secure method that protects your server and automatically provides your site with a free SSL certificate (enabling the https:// padlock).

Prerequisites: Before you begin, you must have two things:
  1. A domain name that you own (e.g., from Namecheap, GoDaddy).
  2. A free Cloudflare account, with your domain already added to it by changing your nameservers.

Create a Cloudflare Tunnel

The Tunnel is the secure connection between our server and Cloudflare's network.

  1. Log in to your Cloudflare dashboard. On the left sidebar, click on "Zero Trust". (You may need to complete a free setup wizard the first time).
  2. In the Zero Trust dashboard, go to Networks → Tunnels.
  3. Click "Create a tunnel". Give it a name you'll recognize (e.g., "my-website-tunnel") and click "Save tunnel".

Get Your Tunnel Token

The token is the secret key that authorizes your server to use the tunnel.

  1. On the next page, under "Choose your environment", select Docker.
  2. Cloudflare will show you a command like docker run cloudflare/cloudflared... followed by a long, random string of text.
  3. Copy only the long string of text (the token), not the entire command.

Add the Token to Your Server

Go back to our control panel for your web server.

  1. Go to the "Startup" tab.
  2. Find the variable named "Cloudflare Tunnel Token" or TUNNEL_TOKEN.
  3. Paste the token you copied from Cloudflare into this variable's text box.
  4. Go to the "Console" tab and restart your server.

Route Traffic to Your Website

The final step is to tell Cloudflare what domain points to your new tunnel.

  1. Go back to the Cloudflare Tunnels dashboard. Your new tunnel should now show a green "Healthy" status. Click its name to configure it.
  2. Go to the "Public Hostname" tab and click "Add a public hostname".
  3. Fill out the form:
    • Subdomain: Type www (or leave blank if you want the site on your root domain, e.g., example.com).
    • Domain: Select your domain from the dropdown.
    • Service → Type: Select HTTP.
    • Service → URL: Type localhost:8080. This tells Cloudflare to send traffic to the Nginx server inside the container.
  4. Click "Save hostname".
Your Site is Now Secure! Your website is live on your custom domain with a valid SSL certificate (HTTPS). Cloudflare will automatically manage and renew this certificate for you.

Basic Setup: Uploading a Static Site

For a simple website made of HTML, CSS, and JavaScript files, you can upload them directly.

  1. In the control panel for your web server, go to the "Files" tab.
  2. Navigate to the /var/www/html/ folder. This is the "web root".
  3. Delete the default index.html file that is already there.
  4. Upload all your website files into this directory. You can drag and drop them or use SFTP.
Your Homepage Must Be `index.html`
The web server is automatically configured to look for a file named index.html to serve as your homepage. Make sure your main page has this exact name.

Advanced Features

Your web server comes with powerful tools for more complex projects.

Using PHP

Any file ending in .php that you place in the /var/www/html/ directory will be automatically processed by the PHP version you selected during server setup. You can test this by creating a file named info.php with the following content:

<?php phpinfo(); ?>

Navigating to https://yourdomain.com/info.php should show you a detailed page with your PHP configuration.

Deploying with Git

This is the most efficient way to manage your website. Instead of uploading files manually, the server can pull them directly from a Git repository (like GitHub or GitLab).

  1. Set Repository in Startup: Go to the "Startup" tab. Enter your repository's clone URL (e.g., https://github.com/user/my-repo.git) into the Git Repository URL variable. You can also specify a branch.
  2. (Optional) Private Repositories: For private repos, you must use an SSH key. In your GitHub/GitLab repo settings, go to "Deploy Keys", click "Add deploy key", and paste the public key. Then, paste the corresponding private key into the Git Private Key startup variable on our panel.
  3. Restart: Restart your server. It will automatically clone the repository into the web root, overwriting any existing files. The server will also automatically run a git pull to get the latest changes every time it restarts.

Automated Tasks (Cronjob)

This server includes a cron engine for running scheduled tasks without needing system access. This is useful for things like clearing a cache or running a PHP maintenance script.

  1. Enable Cron: Go to the "Startup" tab and set the CRON_STATUS variable to 1.
  2. Create Crontab File: In the File Manager, go to the root directory (/home/container/) and create a new file named crontab.
  3. Add Your Jobs: Edit the crontab file and add your scheduled commands using standard cron syntax. For example, to run a PHP script every hour:
0 * * * * php /var/www/html/myscript.php

All cron job output is logged to /home/container/logs/cron.log.

Installing WordPress

You can automatically install WordPress on your server. This is a destructive operation and will wipe any existing files in your web root.

Requires a Database: WordPress needs a MySQL database to function. You must create a Database Server separately first and have your database credentials ready.
  1. Go to the "Startup" tab of your web server.
  2. Find the variable named Install WordPress or INSTALL_WORDPRESS and set its value to 1.
  3. Go to the "Settings" tab and click the red Reinstall Server button.
  4. Once the reinstall is complete, start the server and visit your domain. You will be greeted by the famous WordPress 5-minute installation screen. Follow the on-screen instructions and enter your database credentials when prompted.