0x02 安装GCC与dev库
0x03 安装目录及参数规划
- nginx安装目录: /home/nginx
- nginx配置文件目录: /home/nginx/conf/nginx.conf
- nginx虚拟服务器配置目录: /home/nginx/vhost/
- log日志目录: /home/nginx/log
- pid文件目录: /home/nginx/nginx.pid
- lock锁目录: /home/nginx/run/nginx.lock
- 临时缓存目录: /home/nginx/cache/tmp
- 站点目录: /home/www/wwwroot
- nginx运行用户名: www
- nginx运行用户组: www
0x04 Nginx编译步骤
#创建nginx用户与用户组
groupaddd www
useradd -g www www
#解压nginx源码包并进入nginx源码根目录
[root@localhost ~]# tar -axv -f nginx-1.17.0.tar.gz && cd nginx-1.17.0
#生成makefile文件
./configure \
--prefix=/home/nginx \
--sbin-path=/home/nginx/sbin/nginx \
--conf-path=/home/nginx/conf/nginx.conf \
--error-log-path=/home/nginx/log/error.log \
--http-log-path=/home/nginx/log/access.log \
--pid-path=/home/nginx/nginx.pid \
--lock-path=/home/home/nginx.lock \
--http-client-body-temp-path=/home/nginx/client_temp \
--http-proxy-temp-path=/home/nginx/proxy_temp \
--http-fastcgi-temp-path=/home/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/home/nginx/uwsgi_temp \
--http-scgi-temp-path=/home/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-file-aio \
--with-threads \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module
Configuration summary
+ using threads
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
make && make install
0x06安装成功执行以下命令查看nginx版本号
[root@localhost nginx]# nginx -v
nginx version: nginx/1.17.0