Free Hosting Website On Gitlab - GitLab Pages is a product of the GitLab git repository where we can host HTML static websites or CMS static website generators such as Jekyll, Middleman, Hexo, Hugo, and Pelican.
By default the URL used to access websites hosted on GitLab is https://username.gitlab.io/projectname. This URL can be replaced with our own domain/subdomain and supports HTTPS by using an SSL/TLS certificate from Let's Encrypt.
Here's a tutorial on how to host a free HTML website on GitLab pages
Creating a GitLab Repository
The first step is to create a new repository or project on GitLab. Repositories created for GitLab can be set to private, they don't have to be set to public.
- Push HTML to Repository
The next step is to push the HTML website to the GitLab repository. For how to connect ssh, I have reviewed Akuh.net in the previous article, then
Configure GitLab account in local repository
git config user.name "GitLab Account Name"
git config user.email "[email protected]"
git remote add origin [email protected]:username/projectname.git
- Create a .gitlab-ci.yml file in the HTML website directory.
- Then push it to the GitLab repository
git add .
git commit -m "Initial commit"
git push -u origin master
- Monitor deploy status in Project Name -> CI/CD -> Pipelines. The final result must be passed.
After the pipeline's status changes to pass, it means the HTML website has been successfully deployed to GitLab Pages. But the website doesn't appear right away, if we access the GitLab Pages project URL, the error message that appears is 404. The experiment I did took 10 to 30 minutes
The access URL is http://username.gitlab.io/projectname, you can check it in Project Name -> Settings -> Pages.
The page I created in this article https://akuhnet.gitlab.io/akuhnetwork
How to Change URL with Domain + SSL
- Go to the Project Name -> Settings -> Pages page, click New Domain.
- Enter domain name and enable SSL Let's Encrypt, then Create New Domain.
- Then create a DNS record, CNAME record to hostname username.gitlab.io or it could be A record to IP 188.8.131.52, and TXT record for domain verification.
- After the DNS record is added, click the button for verification. If successful, the status becomes Verified.
- The installation of this domain is also not active immediately, it takes a few minutes.
In addition to using domains, we can also use subdomains.
Thus the article this time for Free Website Hosting On Gitlab for more details, akuh.net include the video below
Any question? write in comments
This tutorial is for educational purposes only
if this tutorial doesn't work please comment, akuh.net will update soon