Hark, the setting up of a Webserver,

Skip to content

This doth be a machine-wrought text which may contain errors!

Forutsetninger

Prerequisites

Før du begynner, må du ha følgende på plass:

  • En server med et operativsystem som støtter webserverprogramvare (f.eks. Linux, Windows Server).
  • Tilgang til serveren via SSH eller lignende.
  • Grunnleggende kunnskap om kommandolinjen.

  • A server, furnished with an operating system that doth support webserver software (e.g., Linux, Windows Server).

  • Access unto the server, by means of SSH or the like.
  • A grounding in the command line, if you please.

Steg-for-steg guide

Step-by-Step Guide

  1. Oppdater pakkelisten: Åpne terminalen og kjør kommandoen sudo apt update.
  2. Installer Apache: Kjør kommandoen sudo apt install apache2.
  3. Start Apache: Kjør kommandoen sudo systemctl start apache2.
  4. Sjekk status: Kjør kommandoen sudo systemctl status apache2 for å verifisere at tjenesten kjører.

  5. Update the package list: Open the terminal and execute the command sudo apt update.

  6. Install Apache: Execute the command sudo apt install apache2.
  7. Start Apache: Execute the command sudo systemctl start apache2.
  8. Check the status: Execute the command sudo systemctl status apache2 to verify that the service doth run.

Konfigurasjon

Configuration

Etter installasjonen må du konfigurere webserveren. Standard dokumentrot er /var/www/html. Du kan endre dette i Apache-konfigurasjonsfilen.

Following the installation, thou must configure the webserver. The default document root is /var/www/html. This may be altered within the Apache configuration file.

Testing

Testing

Åpne en nettleser og naviger til serverens IP-adresse eller domenenavn. Hvis installasjonen var vellykket, skal du se Apache-standard siden.

Open a browser and navigate to the server’s IP address or domain name. If the installation hath been successful, thou shalt behold the Apache default page.

🚧🚧 Work in Progress, Good Sir! 🚧🚧

Dubstep Meme

  • Commands: sudo, apt, cd, nano
  • Software: nginx, apache2

Process for Installation

Ere we may install the software, ‘tis needful we update the APT(itude) package list (the “app store” of Linux):

sudo apt update
# Oppdaterer pakkelisten.
# Verily, doth update the list of packages.

Thereafter may we install the software desired. Here shall we install nginx, which doth be a most popular web server, yet a favoured alternative is also apache2.

sudo apt install nginx
# Installerer Nginx webserveren.
# Doth install the Nginx webserver, forsooth.

Configuration of Web Server and Files

We do oft find configuration files in /etc/<programwarenavn>/. For nginx, ‘tis thus /etc/nginx/. We need not gaze upon this anon, but shouldst thou wish to amend aught in the configuration, such as port, additional web servers, SSL certificates, and the like, ‘tis here thou shalt do it.

Web files, that is to say, HTML, CSS, JavaScript, and so forth, do commonly lie in /var/www/html/. Here mayst thou add thine own files. For example, thou canst create an index.html file here with some simple HTML code.

cd /var/www/html/
sudo nano index.html
# Dette er en kommentar om å åpne index.html for redigering.
# Forsooth, this doth comment upon the opening of index.html for the purpose of editing.

nano - A trifle concerning the text editor

Nano is a most basic text editor which may be used within the terminal. ‘Tis easy to wield and doth require little prior knowledge.

Some fundamental commands:

  • CTRL + S - To save the file
  • CTRL + X - To quit nano

Shouldst thou press CTRL + X without having saved, it shall ask if thou wishest to save the file. Press Y for yea, N for nay. Thereafter, press ENTER to confirm the file name.

To Commence and Cease the Webserver

When the installation doth conclude, we may commence the webserver with:

sudo systemctl start nginx
# Starter nginx-tjenesten.
# Doth commence the Nginx service, forsooth.

systemctl - what doth it signify?

systemctl doth mean “system control” and is a tool for the governing of system services in Linux. ‘Tis used to commence, cease, renew, and ascertain the state of services that run in the background upon the system.

systemctl start | stop | restart | status <tjenestenavn>

Pray, then visit http://<serverens-ip-adresse>/ within thy browser, to see if the webserver doth run.

Finne serverens IP-adresse

To discover the server’s IP address, thou mayest employ this command:

hostname -I # Stor I

Or, alternatively, thou canst make use of ip a or ifconfig, yet these do yield more information than merely the IP address itself.