Creating a Simple Website on Vultr With OpenBSD and httpd

Introduction

The purpose of this guide is to show you how easy it is to make a homepage for your website on Vultr with OpenBSD and httpd.

Creating the Instance

Head over to https://my.vultr.com/deploy/. This is the main page for deploying new servers. However, before installing anything on your server, we must first create it. Thankfully, Vultr has made this process very easy:

  1. Choose where you would like the server to be located at.
  2. Select "64bit" and then "OpenBSD".
  3. Select the desired hardware specifications for the new instance.
  4. Select any additional features you need.
  5. If you have any startup scripts place them here.
  6. Create and add your SSH key. (See this guide)
  7. Finally enter the Hostname and Label for the server. For this guide, we will use My-Website-01.

After checking the summary at the bottom of the page and making sure everything is correct, click the Deploy Now button. Allow a minute or two for the server to be created. Afterwards you will be redirected to a new page that shows the status of all your servers.

Once the status tab turns green on the newly created server, everything is up and running. Click the manage link next to it and you will be taken to the server information page. You will see Server Information (My-Website-01) at the top of the page. From here you can manage the server and view the root password by clicking the eye icon.

Update DNS Records

Next you should record the IP address assigned to your server and point your DNS records at it. You can read more about how to do this here.

Logging into the Server over SSH as root

Open up your SSH program and connect to your server as root. Please note that this is heavily frowned upon so we will only be doing this once in order to create a non-root user with elevated privileges. Once you have connected to your server over SSH, make an account for yourself. To do this enter adduser into the terminal. You will now be prompted with several questions about the new account. The only two things you are required fill out are your username and password. The rest of the questions are optional.

After making the account, the final thing that must be done is enabling elevated privileges for it. While you are still logged in as root, enter the following into the terminal:

user mod -G wheel username

This will place your account in the wheel group, allowing you to act as root.

Logging into the Server over SSH with your new username

We are now finished with creating your account. Exit the server and reconnect with your new account. The first thing you should do is enter su into the terminal. You will be asked the password for the root account.

Creating a directory for your Website

Now we need to make a directory for your website:

mkdir -p /var/www/htdocs/yourwebsite.com

Configuring httpd

Let's make the configuration file:

vi /etc/httpd.conf

Type the following into the file:

# Main Configuration
server "yourwebsite.com" {
    listen on * port 80
    root "/htdocs/yourwebsite.com"
}

# This is a redirect to the Main Configuration
server "www.yourwebsite.com" {
    listen on * port 80
    block return 301 "http://yourwebsite.com$REQUEST_URI"
}

Save and exit.

Checking the configuration settings and starting httpd

Go ahead and make sure everything is working:

httpd -n

You will see httpd(ok). This indicates that everything is working.

The final two things we need to do for httpd is enable it, and then start it.

Enable httpd:

rcctl enable httpd

Start httpd:

rcctl start httpd

You will now be able to access your website over the internet, however you will get a 403 status code because there's nothing in the website directory. Let's change that.

Creating a simple Webpage

Create your homepage by typing the following:

vi /var/www/htdocs/yourwebsite.com/index.html

Populate it with the following:

<!DOCTYPE html>
<html>
    <head>
        <title>Hello World</title>
    </head>

    <body>
        <p>Welcome to my OpenBSD server on Vultr!</p>
    </body>
</html>

Save and exit, and you have successfully created your first website on OpenBSD.

Dejar un comentario

ZPanel y Sentora en CentOS 6 x64

ZPanel y Sentora en CentOS 6 x64

ZPanel, un panel de control de alojamiento web popular, se bifurcó en 2014 a un nuevo proyecto llamado Sentora. Aprende a instalar Sentora en tu servidor con este tutorial.

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Cómo instalar Vtiger CRM Open Source Edition en CentOS 7

Aprende cómo instalar Vtiger CRM, una aplicación de gestión de relaciones con el cliente, en CentOS 7 para aumentar tus ventas y mejorar el servicio al cliente.

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Cómo instalar el servidor Counter-Strike 1.6 en Linux

Esta guía completa le mostrará cómo configurar un servidor Counter-Strike 1.6 en Linux, optimizando el rendimiento y la seguridad para el mejor juego. Aprende los pasos más recientes aquí.

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

¿Puede la IA luchar con un número cada vez mayor de ataques de ransomware?

Los ataques de ransomware van en aumento, pero ¿puede la IA ayudar a lidiar con el último virus informático? ¿Es la IA la respuesta? Lea aquí, sepa que la IA es una bendición o una perdición

ReactOS: ¿Es este el futuro de Windows?

ReactOS: ¿Es este el futuro de Windows?

ReactOS, un sistema operativo de código abierto y gratuito, está aquí con la última versión. ¿Puede satisfacer las necesidades de los usuarios de Windows de hoy en día y acabar con Microsoft? Averigüemos más sobre este estilo antiguo, pero una experiencia de sistema operativo más nueva.

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Manténgase conectado a través de la aplicación de escritorio WhatsApp 24 * 7

Whatsapp finalmente lanzó la aplicación de escritorio para usuarios de Mac y Windows. Ahora puede acceder a Whatsapp desde Windows o Mac fácilmente. Disponible para Windows 8+ y Mac OS 10.9+

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

¿Cómo puede la IA llevar la automatización de procesos al siguiente nivel?

Lea esto para saber cómo la Inteligencia Artificial se está volviendo popular entre las empresas de pequeña escala y cómo está aumentando las probabilidades de hacerlas crecer y dar ventaja a sus competidores.

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

La actualización complementaria de macOS Catalina 10.15.4 está causando más problemas que resolver

Recientemente, Apple lanzó macOS Catalina 10.15.4, una actualización complementaria para solucionar problemas, pero parece que la actualización está causando más problemas que conducen al bloqueo de las máquinas Mac. Lee este artículo para obtener más información

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

13 Herramientas comerciales de extracción de datos de Big Data

¿Qué es un sistema de archivos de diario y cómo funciona?

¿Qué es un sistema de archivos de diario y cómo funciona?

Nuestra computadora almacena todos los datos de una manera organizada conocida como sistema de archivos de diario. Es un método eficiente que permite a la computadora buscar y mostrar archivos tan pronto como presiona buscar.