nginx源码编译安装
1,下载源码包。www.nginx.org/downloadnginx
创建工作目录
cd /usr/local/src/
mkdir {tarbag,software}
创建工作用户
useradd nginx
[root@emporerlinux tarbag]# wget http://nginx.org/download/nginx-1.23.3.tar.gz
[root@emporerlinux tarbag]# pwd
/usr/local/src/tarbag
2,解压
[root@emporerlinux tarbag]# tar -zxvf nginx-1.23.3.tar.gz -C ../software/
3,安装编译依赖
yum –y install gcc make pcre pcre-devel zlib zlib-devel openssl-devel libxml2-devel libxslt-devel gd-devel perl-devel perl-ExtUtils-Embed
4,执行源码安装三部曲 ./configure, make, make install
[root@emporerlinux tarbag]# cd ../software/
[root@emporerlinux software]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_perl_module=dynamic --with-threads --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-compat --with-file-aio --with-http_v2_module
[root@emporerlinux nginx-1.23.3]# make && make install
5,启动nginx
[root@emporerlinux sbin]# /usr/local/nginx/sbin/nginx
6,验证
7,总结:nginx安装位置为./configure --prefix=/usr/local/nginx 下,安装模块可以执行查看,./configure 是会报错,一一对应安装依赖即可,可以定制模块。不需要一些模块就少一些依赖。这只是一个实例,源码包安装大同小异
[root@emporerlinux nginx-1.23.3]# ./configure --help
源码安装需要规范。不然以后你自己都不知道自己做了啥。Tomcat和jdk源码安装也一样
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
Emporer-Linux!
喜欢就支持一下吧