Install nginx on the virtual machine (Leyou Mall)

First, download the nginx installation package
Insert picture description here

Start the virtual machine
Insert picture description here
Click on the terminal:
use su-root to enter the administrator privileges
Insert picture description here
and then close the firewall: (restart to take effect, you can also turn
off later) chkconfig iptables off

Then add a new user leyou, here we do not set a password. After
Insert picture description here
adding a new user, a new leyou will be added under home. The cd command enters this directory, and then we upload the installation package here:
Insert picture description here
upload can use the tool FileZilla

Start tool

Insert picture description here
Insert picture description here
Insert picture description here
Click to connect:
Insert picture description here
then enter the terminal to decompress: tar -xvf nginx-1.10.0.tar.gz
Insert picture description here
and
Insert picture description here
then install the dependency package (in the nginx directory)

Because the functions in nginx are all modular, and modules rely on some software packages (such as pcre library, zlib library and openssl library) to use. Therefore, before installing nginx, you need to complete the installation of the software packages that the nginx module depends on.

pcre-devel package: provides regular expression library for nginx module
zlib-devel package: provides function library for data compression for nginx module
openssl-devel package: provides cryptographic algorithm, certificate and SSL protocol for nginx module

Install yum through the yum command method -y install pcre-devel openssl-devel

Here, the zlib-devel package is not installed through the yum command, and depending on the installation process, the yum command will automatically help resolve the dependencies during the installation.

When the installation is complete, we can see that the installed packages are openssl-devel and pcre-devel, and we can see that the packages installed as dependencies contain the zlib-devel package that we originally needed to install.


Then configure the installation directory: (under the nginx directory)
./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx

Then install: make && make install

Then start nginx through the nginx command.
Insert picture description here
If it starts correctly, you can see two processes here.
(If the error is here, the firewall may not be closed, you can turn off the firewall and try again, and remember to restart after turning off the firewall)

Open the browser to access the virtual machine address and
Insert picture description here
the installation is successful.
Attachment: This is another tutorial link for
nginx installation. You can also refer to it. So far, nginx is installed successfully.

Guess you like

Origin blog.csdn.net/zcylxzyh/article/details/98072052