First, download the nginx installation package
Start the virtual machine
Click on the terminal:
use su-root to enter the administrator privileges
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
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:
upload can use the tool FileZilla
Start tool
Click to connect:
then enter the terminal to decompress: tar -xvf nginx-1.10.0.tar.gz
and
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.
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
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.