Install nginx from linux source code
Install dependencies:
yum -y install gcc-c++ zlib zlib-devel pcre pcre-devel openssl openssl-devel
Step 1: Upload the nginx source code package nginx-1.8.0.tar.gz to the Linux system
Step 2: Unzip
tar zxvf nginx-1.8.0.tar.gz
Step 3: Enter the nginx-1.8.0 directory
You can see that there is a configure executable file. Green represents the executable file.
Use the configure command to create the makeFile file.
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-file-aio \
--with-http_realip_module \
--with-stream
You can see the Makefile after execution
Step 4: Compile
make
After typing make and pressing Enter, you can see that many c files have been generated.
Step 5: Installation
make install
nginx exit and reload
./nginx -s stopAbnormal exit is equivalent to killing the process
./nginx -s quitExit normally
./nginx -s reloadReloading the configuration file means loading the above Makefile