Construction of nginx1.18.0 on a virtual machine

1. Before building nginx, download and install the pcre function library
pcre download address https://sourceforge.net/projects/pcre/ to download the latest 8.44 version
Construction of nginx1.18.0 on a virtual machine
2.
After installing pcre and downloading, upload rz -be to the virtual machine and unzip it to the root directory under

tar zxvf pcre-8.44.tar.gz -C./

Grant all read and write permissions to the current folder

chmod 777 -R /root/pcre-8.44,

cd into the pcre-8.44 directory and install the gcc plugin

yum -y install gcc
yum -y install gcc-c++

Initialize configuration and install

./configure
make&&make install

Enter the pcretest command interface

./pcretest

Construction of nginx1.18.0 on a virtual machine
ctrl + c to exit the successful installation of PCRE
can view the version number pcre

pcre-config --version

3. Install nginx
nginx download address http://nginx.org/ , download the stable version of nginx-1.18.0 version, rz -be upload the compressed package from the local to the virtual machine
decompress it to the root directory

tar zxvf nginx-1.18.0.tar.gz -C ./

Install plugin

yum install -y zlib-devel

Go to the nginx-1.18.0 directory and initialize the installation configuration

cd nginx-1.18.0

Need to compile and install

./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

Possible errors
Error 1: ./configure: error: the invalid value in --with-ld-opt="-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E"
Solution: yum -y install redhat-rpm-config.noarch
error 2: ./configure: error: the HTTP image filter module requires the GD library.
Solution: yum -y install gd-devel
error 3: ./configure: error: perl module ExtUtils::Embed is required
Solution: yum -y install perl-devel perl-ExtUtils-Embed
error 4: ./configure : error: SSL modules require the OpenSSL library.
Solution: yum -y install openssl openssl-devel
error 5: ./configure: error: the HTTP XSLT module requires the libxml2/libxslt
solution: yum -y install libxslt-devel
error 6: /configure: error: the GeoIP module requires the GeoIP library.
Solution: yum -y install geoip-devel
error 7: /configure: error: the Google perftools module requires the Google perftools
solution: yum -y install gperftools-devel

make&&make install

Construction of nginx1.18.0 on a virtual machine
Successful installation

View the nginx version number

nginx -v 或 nginx -V

4. Open nginx

cd /usr/sbin
./nginx

Possible
Construction of nginx1.18.0 on a virtual machine
solutions

useradd -s /sbin/nologin -M nginx
id nginx
/usr/local/nginx/sbin/nginx
mkdir -p /var/lib/nginx/tmp/client_body
cd /usr/sbin/
./nginx

View port number

netstat -nlpt

Construction of nginx1.18.0 on a virtual machine
Port 80 appears, indicating that the startup is successful.
According to this installation, the nginx configuration file is under /etc/nginx/nginx.conf

Guess you like

Origin blog.51cto.com/14998880/2561277