nginx installation
1. rpm -qa | grep gcc Check whether g++ and gcc are installed
2、yum install gcc-c++
3. Download pcre2-10.22.tar.gz and nginx-1.8.1.tar.gz
4、tar zxvf pcre2-10.22.tar.gz
5、cd pcre2-10.22
6、./configure
7、make
8、make install
9. Create the www user used by the user nginx
groupadd www #Add www group
useradd -g www www -s /bin/false #Create nginx running account www and add it to the www group, do not allow www users to log in directly to the system
10. Create nginx log directory
chown www:www /logs/nginx -R
11. Install zlib-devel, if already installed, skip yum install -y zlib-devel
12. Unzip nginxtar zxvf nginx-1.8.1.tar.gz
13、cd nginx-1.8.1
14、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
15、./configure: error: the HTTP rewrite module requires the PCRE library.
Install pcre-devel to solve the problem yum -y install pcre-devel
16、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
17、./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.
Install yum -y install openssl openssl-devel solution
18、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
19、make
20、make install
21. Check if the installation is successful
cd /usr/local/nginx/sbin
./nginx -t
The results show that:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful