nginx relies on the following software libraries. Please make sure to install these software libraries before installation. They include: gcc, openssl, zlib, pcre (you can check whether it is installed through the rpm -q command). The first three libraries can be installed through the system. Disk to install, here is just a brief introduction to the installation of pcre:
Download pcre to the /home directory, the version selected here is pcre-8.10, after downloading, perform the following operations
[plain] view
plaincopy
- 1.[root@localhost home]# tar zxvf pcre-8.10.tar.gz //Decompress
- 2.[root@localhost home]# cd pcre-8.10 //switch to In this directory
- 3.[root@localhost pcre-8.10]#./configure pcre-8.10]#make install //Install
Install nginx- Download the stable version from the official website of nginx. The version number downloaded here is nginx-1.0.2. By default, the compiled and installed Nginx contains most of the available modules. You can set the usage of each module through the "./configure --help" option. For example, for the unnecessary http_ssi module, you can use "--without- http_ssi_module" parameter turns off this module; if you need the "http_perl" module, you can install this module through the "--with-http_perl_module" parameter. Perform the following operations to install
[plain] view
plaincopy
1.[root@localhost home]# tar zxvf nginx-1.0.2.tar.gz
2.[root@localhost home]#cd nginx-1.0.2 - 3.[root@localhostnginx-1.0.2]#./configure --with-http_stub_status_module --prefix=/usr/local/nginx
- 4.[root@localhost nginx-1.0.2]#make
- 5.[root@localhost nginx-1.0.2]#make install
-
Use the "with-http_stub_status_module" parameter during configuration to enable the NginxStatus function of Nginx to monitor the current status of Nginx.
- After the installation is complete, perform the following operations to verify whether the installation is successful:
[plain] view
plaincopy
cd /usr/local/nginx/sbin
./nginx -t -
The result shows:
nginx: the configuration file /usr/local/nginx/conf/nginx . conf syntax is ok- nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successfulAt this point, the installation of nginx has been successfully completed.
Start nginx
cd /usr/local/nginx/sbin ./nginx //Start nginx
Enter in the browser: http://localhost to verify whether nginx starts successfully
Stop nginx
pkill -9 nginx
The above introduces the installation and configuration of Nginx under Linux, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.