Table of Contents

Free Website Hosting | WordPress

Share on facebook
Share on twitter
Share on telegram
Share on linkedin
Share on whatsapp
Share on reddit
Share on email

You’re looking for free website hosting?

Well, let me introduce you to WordPress!

WordPress is a free way to host and design your website. Mostly used by blogs like this one.

WordPress has thousands upon thousands of users and if you’re ever in need of help you can google it, and you’ll probably find your problem in a few seconds.

Check out more about WordPress on GitHub, DockerHub, WordPress or on the WordPress Wiki

BTW. you can host as many websites as your server can handle.

That is useful if you want to host websites for clients or just have multiple Websites to host.

If you want to host multiple Websites for one Client or just for yourself you can set up WordPress Multisite. I’ll explain how to do this further down below.

Download the WordPress App for Android and IOS.

 

1. Setting it up

You need Traefik set up!

Create a new subdomain and point it to your server.

 

Again, make a new directory and cd into it.

mkdir mywebsite && cd mywebsite

At first, we’ll have to set up the docker-compose.yml

nano docker-compose.yml

And paste the following:

version: '3'

services:
  mywebsite-db:
    image: mysql:latest
    container_name: mywebsite-db
    restart: always
    env_file: .env
    environment:
      - MYSQL_DATABASE=wordpress
    volumes:
      - ./dbdata:/var/lib/mysql
    command: '--default-authentication-plugin=mysql_native_password'
    networks:
      - backend

  mywebsite-wordpress:
    depends_on:
      - mywebsite-db
    image: wordpress:latest
    container_name: mywebsite-wordpress
    restart: always
    env_file: .env
    environment:
      - WORDPRESS_DB_HOST=mywebsite-db
      - WORDPRESS_DB_USER=$MYSQL_USER
      - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
      - WORDPRESS_DB_NAME=wordpress
    volumes:
      - ./wordpress:/var/www/html
    networks:
      - backend
      - web
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.mywebsite-web.rule=Host(`your-domain.com`)"
      - "traefik.http.routers.mywebsite-web.entrypoints=web"
      - "traefik.http.routers.mywebsite-web.middlewares=redirect@file"
      - "traefik.http.routers.mywebsite-secured.rule=Host(`your-domain.com`)"
      - "traefik.http.routers.mywebsite-secured.entrypoints=web-secured"
      - "traefik.http.routers.mywebsite-secured.tls.certresolver=mytlschallenge"

networks:
  web:
    external: true
  backend:
    external: false

Save and create an environment file:

nano .env

And paste this: (Replace the passwords!)

MYSQL_ROOT_PASSWORD=secure_password
MYSQL_USER=wordpress
MYSQL_PASSWORD=password

Now save and spin up the Stack

docker-compose up -d

 

2. Setting up your Website Hosting

Visit your-domain.com.

At first start, you’ll have to choose your language.

Wordpress language select

Next, you’ll need to set up your user.

Free website hosting set up user

We have successfully set up a website for free, using WordPress.

WordPress user set up success

You’ll need to log in with your created user.

And you’re done!

Wordpress dashoboard

3. WordPress Multisite

You don’t have to do this step if you don’t want to use multiple Websites for the same user!

This is only useful if you want to set up different websites, like a blog on blog.your-domain.com and your-domain.com is your professional site.

If you want to host multiple websites that are not for the same user, just create a new website folder and set up the same as step 1 in there (with different domain values and names for the services and containers of course).

 

NOW. Let’s create WordPress Multisite.

We’ll need to get into the container:

docker exec -it mywebsite-wordpress /bin/bash

and change the wp-config.php file.

nano wp-config.php

Above: /* That’s all, stop editing! Happy publishing. */ add “define( ‘WP_ALLOW_MULTISITE’, true );”, so it looks like this:

define( 'WP_ALLOW_MULTISITE', true );
/* That's all, stop editing! Happy publishing. */

Now refresh your page and you’ll see a Network Setup tab under the Tools section.

Network Setup WordPress multisite

If you click on it you’ll see the next steps.

You’ll have to add this to the wp-config.php:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'site.rahn-tech.de');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

So it now looks like this:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'site.rahn-tech.de');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define( 'WP_ALLOW_MULTISITE', true );
/* That's all, stop editing! Happy publishing. */

Delete and create the .htaccess file:

rm .htaccess && nano .htaccess

Pathe this:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

Now refresh your site and log in again.

You can now set up your Multisite WordPress Network.

setting up wordpress multisite wordpress network

Click on install and you’re done!

Add sites to your wordpress network

You can now add as many sites as your server is able to handle.

Related Post
minecraft

How to host a Forge Server

Playing Minecraft with Mods on a Docker hosted Minecraft Server.
Ads

Comments

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x