Getting our very own Nginx server running on our Alpine Linux virtual machine.
Server is online

Getting our very own Nginx server running on our Alpine Linux virtual machine.

Welcome back to another tutorial from our Alpine Linux explorations tutorial series.

This time we are going to get our very own Nginx server running on our Alpine Linux virtual machine.

?We need to complete a number of steps to get it working correctly.

?1. We need to power on our Alpine Linux virtual machine from the Oracle Virtual Box Manager.

Power on the Alpine Linux Virtual Machine
Power on the Alpine Linux Virtual Machine

2. Once our Alpine Linux virtual machine execution environment has fully booted we are ready to begin the process – system ready.

Login to our Alpine Linux Virtual machine
Login to our Alpine Linux Virtual machine

?3. We need to open the Linux Terminal.

Open the Linux Terminal
Open the Linux Terminal

?4. We need to switch to the root user to run the necessary commands to install the Nginx server correctly.?

Use the root account
Use the root account

?5. We first need to update our Alpine Linux virtual machine execution environment. First, run the command ‘apk update’.

Run the command apk update
Run the command apk update

?6. We then need to run the command ‘apk upgrade’.

Run the command apk upgrade
Run the command apk upgrade

?7. Now the Alpine Linux virtual machine execution environment is fully updated.?

Alpine Linux virtual machine execution environment is now updated
The Alpine Linux virtual machine execution environment is now updated

?8. We need to run the command ‘reboot’.

Now we run the command reboot
Now we run the command reboot

?9. Now we need to log back in, open the Linux Terminal again and switch to the root account. Now we can add the Nginx server packages. Please run the command ‘apk add nginx’.

Run the Linux Terminal command apk add nginx
Run the Linux Terminal command apk add nginx

10. Now we need to prepare a user and a user group for the nginx server to run correctly on our Alpine Linux execution environment. To achieve this, we need to run the command ‘adduser -D -g 'www' www’.

We need to run the command ‘adduser -D -g 'www' www’.
We need to run the command ‘adduser -D -g 'www' www’.

11. We also need to prepare a folder for the html files for our web pages. For this purpose, we need to run the following commands:

“mkdir /www”

“chown -R www:www /var/lib/nginx”

“chown -R www:www /www”

We need to create the folder for the html files
We need to create a folder for the html files
We need to establish the correct access permissions
We need to establish the correct access permissions
We need to establish the correct access permissions
We need to establish the correct access permissions

12. Now we need to create the nginx server configuration file and set it to listen on port 80 and use HTML files. We need to run the command ‘gedit /etc/nginx/nginx.conf’.

We need to create the nginx configuration file
We need to create the nginx configuration file
We have now created the nginx configuration file
We have now created the Nginx configuration file

13. We also need to create the sample web page to be later able to check if our server is indeed running correctly. We need to run the command ‘gedit /www/index.html’.

We now need to create the sample web page
We now need to create the sample web page
This is the html sample webpage
This is the HTML sample webpage

14. Let’s start our new Nginx server running on our Alpine Linux virtual machine execution environment.

We need to run the command ‘rc-service nginx start’.

Since we already have the Apache web server running here listening on port 80
Since we already have the Apache web server running here listening on port 80

Since we already have the Apache web server running here listening on port 80, the process has failed.

We need to reconfigure the nginx server to run by listening on port 81.

We shall again run the command ‘gedit /etc/nginx/nginx.conf’.

Now we set the nginx server to listen on port 81
Now we set the nginx server to listen on port 81

Now the nginx server is active.

Now the nginx server is active
Now the nginx server is active

Nginx server test is successful
The Nginx server test is successful

15. Now we need to add the nginx server to our system boot configuration. We shall run the command ‘rc-update add nginx default’.

Our great work is now completed
Our great work is now completed

Our great work is now completed.

Server is online
Server is online

We can now check our work and shut down our system.

Poweroff command
Poweroff command

See you in the next one!

#linux

要查看或添加评论,请登录

社区洞察

其他会员也浏览了