Avast ye, this be a machine-translated text an’ may contain errors, aye!
Installin’ the Webserver, Ye Scallywag!
🚧🚧 Avast ye, work be underway! 🚧🚧
- Commands:
sudo,apt,cd,nano - Software:
nginx,apache2
Process for Installin’
Before we can install the software, we be needin’ to update the APT(itude) package list (“the app store” o’ Linux):
sudo apt update
# Oppdaterer pakkelisten - Ahoy, be updatin' the treasure map!
Aye, then we can be installin’ the software o’ our likin’. Here we be installin’ nginx, which be a right popular web server, but a favoured alternative be also apache2.
sudo apt install nginx
# Installer Nginx - Av, matey! We be needin' this for servin' up our treasure!
Configurin’ o’ the Web Server an’ Files
We usually find configuration files in /etc/<program name>/. For nginx, ‘tis be /etc/nginx/. We needn’t gaze upon ‘em now, but if ye be lookin’ to change somethin’ in the configuration, such as port, extra web servers, SSL certificates, and the like, ‘tis where ye’ll be doin’ it.
Web files, that be HTML, CSS, JavaScript, and such, usually lie in /var/www/html/. Here ye can add yer own files. For example, ye can create an index.html file here with a bit o’ simple HTML code.
cd /var/www/html/
sudo nano index.html
nano - A bit about the text editor
Nano be a right simple text editor ye can use in the terminal. ‘Tis easy to use and don’t require much learnin’.
Some basic commands:
CTRL + S- Save the fileCTRL + X- Exit nano
If ye press CTRL + X without savin’, it’ll ask if ye want to save the file. Press Y for aye, N for nay. Then ye press ENTER to confirm the file name.
Startin’ and Stoppin’ the Web Server
Once the installin’ be done, we can start the web server with:
sudo systemctl start nginx
systemctl - what be it?
systemctl means “system control” and be a tool for controllin’ system services in Linux. ‘Tis used to start, stop, restart, and check the status o’ services that be runnin’ in the background on yer system.
systemctl start | stop | restart | status <servicename>
Then steer yer browser to http://<the-servers-ip-address>/ to see if the webserver be runnin’.
Findin’ the server’s IP address
To find the IP address o’ yer server, ye can use this command:
hostname -I # Big I
Alternatively, ye can use ip a or ifconfig, but them be givin’ more info than just the IP address.
