--add-module=PATH enable external module
--add-dynamic-module=PATH enable dynamic external module
--with-compat dynamic modules compatibility
--with-cc=PATH set C compiler pathname
--with-cpp=PATH set C preprocessor pathname
--with-cc-opt=OPTIONS set additional C compiler options
--with-ld-opt=OPTIONS set additional linker options
--with-cpu-opt=CPU build for the specified CPU, valid values:
pentium, pentiumpro, pentium3, pentium4,
athlon, opteron, sparc32, sparc64, ppc64
--without-pcre disable PCRE library usage
--with-pcre force PCRE library usage
--with-pcre=DIR set path to PCRE library sources
--with-pcre-opt=OPTIONS set additional build options for PCRE
--with-pcre-jit build PCRE with JIT compilation support
--with-zlib=DIR set path to zlib library sources
--with-zlib-opt=OPTIONS set additional build options for zlib
--with-zlib-asm=CPU use zlib assembler sources optimized
for the specified CPU, valid values:
pentium, pentiumpro
--with-libatomic force libatomic_ops library usage
--with-libatomic=DIR set path to libatomic_ops library sources
--with-openssl=DIR set path to OpenSSL library sources
--with-openssl-opt=OPTIONS set additional build options for OpenSSL
--with-debug enable debug logging
添加模块,编译
[root@nginx nginx-1.15.2]# ./configure --prefix=/usr/local/lnmp/nginx --with-http_ssl_module --with-http_stub_status_module --with-file-aio --with-threads --user=nginx --group=nginx
编译成功后执行安装命令
[root@nginx nginx-1.15.2]# make && make install
添加用户
[root@server1 nginx-1.10.1]# useradd -s /sbin/nologin -M nginx
创建软链接,便于启动
[root@nginx nginx-1.15.2]# ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/local/sbin/
开启Nginx
[root@nginx nginx-1.15.2]# nginx
[root@nginx nginx-1.15.2]# ps ax| grep nginx
7066 ? Ss 0:00 nginx: master process nginx
7067 ? S 0:00 nginx: worker process
7069 pts/0 S+ 0:00 grep --color=auto nginx
至此,已经成功安装Nginx,访问 http:ip
平滑加载
[root@nginx nginx-1.15.2]# nginx -s reload
关闭Nginx
[root@nginx nginx-1.15.2]# nginx -s stop
编译时选择需要的模块不同,或者需要改变安装路径、用户等,则要重新编译或者重新安装Nginx
重新编译
[root@nginx ~]# ls
nginx-1.15.2 nginx-1.15.2.tar.gz
[root@nginx ~]# cd nginx-1.15.2
[root@nginx nginx-1.15.2]# make clean
rm -rf Makefile objs
[root@nginx nginx-1.15.2]# ./configure --prefix=/usr/local/web/nginx --with-http_ssl_module --with-http_stub_status_module --with-file-aio --with-threads --user=nginx --group=nginx