Self Hosting
I want to self host services like
-
Simplelogin
-
Nextcloud
-
I will be documenting my process of hosting these services in this section
Simplelogin
Nextcloud
I will be documenting my process of hosting these services in this section
hugo new site <website-name>
cd <website-name>
git init
hugo
command.public
folder in your website directory.Create 2 seperate repositories for the website (public folder) and the other source code.
Add the public folder to the .gitignore
file in the source code repository.
Add the source code repository as a submodule in the public folder.
cd public
git init && git add . && git commit -m "Initial commit"
git submodule add <source-code-repo-url> <path-to-source-code-repo>
Push the public folder to a remote repository (I am using GitLab)
I am using a Ubuntu 22.04 server with 1GB RAM and 1vCPU on Oracle Cloud.
sudo apt update && sudo apt upgrade -y
sudo apt remove docker docker-engine docker.io containerd run
sudo apt update
sudo apt install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] <https://download.docker.com/linux/ubuntu> \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker $USER
my-services
with following command
docker network create my-services
apps
in home dirapps/nginx
apps/nginx/data
apps/nginx/letsencrypt
(its only required if you want to use letsencrypt)apps/nginx/docker-compose.yml
with following content:version: '3.8'
services:
nginx:
container_name: 'nginx'
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./nginx/data:/data
- ./nginx/letsencrypt:/etc/letsencrypt
networks:
- my-services
networks:
my-services:
name: 'my-services'
external: true
docker-compose up -d
to start nginx proxy manager.[email protected]
changeme
SSL/TLS
tabFull
under Overview
sectionEdge Certificates
tab and enable Always Use HTTPS
optionSSL/TLS
tab and enable Automatic HTTPS Rewrites
optionDNS
section and add following records:
A
record with name @
and value your-server-ip
A
record with name www
and value your-server-ip
Origin Certificates
tab and click on Create Certificate
SSL Certificates
and add the certificate and key files.public
folder)cd
into the apps folder created earliermkdir blog-site
cd blog-site
git clone <repo-url>
git clone https://username:[email protected]/username/blog-site.git
nginx
container (not Nginx Proxy Manager) and mounted the public
folder to /usr/share/nginx/html
in the container.docker-compose.yml
file for the container:# ~/apps/blog-site/docker-compose.yml
version: '3.8'
services:
blog:
container_name: 'blog'
image: 'nginx:stable'
restart: unless-stopped
expose:
- '80:80'
volumes:
- ./<path-to-cloned-folder>:/usr/share/nginx/html
networks:
- my-services
networks:
my-services:
name: 'my-services'
external: true
Proxy Hosts
tab.Add Proxy Host
and fill in the details: