Home  >  Article  >  Backend Development  >  Installation and configuration of Nginx under Linux

Installation and configuration of Nginx under Linux

WBOY
WBOYOriginal
2016-07-29 09:11:54783browse

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. 1.[root@localhost home]# tar zxvf pcre-8.10.tar.gz //Decompress
  2. 2.[root@localhost home]# cd pcre-8.10 //switch to In this directory
  3. 3.[root@localhost pcre-8.10]#./configure ​pcre-8.10]#make install //Install
  4. Install nginx
  5. 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
  1. 3.[root@localhostnginx-1.0.2]#./configure --with-http_stub_status_module --prefix=/usr/local/nginx
  2. 4.[root@localhost nginx-1.0.2]#make
  3. 5.[root@localhost nginx-1.0.2]#make install
  4. Use the "with-http_stub_status_module" parameter during configuration to enable the NginxStatus function of Nginx to monitor the current status of Nginx.
  5. 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
  1. The result shows:
  2. nginx: the configuration file /usr/local/nginx/conf/nginx . conf syntax is ok
  3. nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successfulAt this point, the installation of nginx has been successfully completed.
  4. 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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn