Hopp til innhold

The Installation of the Web-Server

Skip to content

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

The Installation of the Webserver

🚧🚧 Labor is yet ongoing! 🚧🚧

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 desired software. Herein shall we install nginx, which is a most popular webserver; yet a popular alternative doth also exist in 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
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 be this?

systemctl signifieth “system control” and is a tool to govern system services within Linux. It is employed to commence, cease, restart, and behold the state of services that run in the shadows of 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.

Find the server’s IP address

To find thy server’s IP address, thou mayest use this command:

hostname -I # Big I

Alternatively, thou canst employ ip a or ifconfig, yet these shall yield more tidings than merely the IP address.