注册 登录

清河洛

Nginx的源码安装

qingheluo2018-04-27清河洛425
一、依赖安装yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-develperl-ExtUtils-Embed二、源码安装./configure--user=www \ #worker进程运行用户--group=www \ #worker进程运行的组--prefix=/usr/ \ #Nginx安装的根路径,所有其他的路径都要依赖于改选项--conf-path=/etc/nginx/nginx.conf \ #如果在命令行没有指定配置文件,那么将会通过这里指定的路径,Nginx将会去那里查找它的配置文件--sb...

一、依赖安装

yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-develperl-ExtUtils-Embed

二、源码安装

./configure

--user=www \ #worker进程运行用户

--group=www \ #worker进程运行的组

--prefix=/usr/ \ #Nginx安装的根路径,所有其他的路径都要依赖于改选项

--conf-path=/etc/nginx/nginx.conf \ #如果在命令行没有指定配置文件,那么将会通过这里指定的路径,Nginx将会去那里查找它的配置文件

--sbin-path=/usr/sbin/nginx \ #指定Nginx二进制文件的路径。如果没有指定,那么这个路径会依赖于--prefix选项

--error-log-path=/var/log/nginx/nginx_error.log \ #指定错误文件的路径,Nginx将会往其中写入错误日志文件,除非有其他配置

--http-log-path=/var/log/nginx/nginx_access.log \ #http访问日志的默认路径

--pid-path=/usr/local/nginx/run/nginx.pid \ #指定的文件将会写入Nginx master进程的pid,通常在/var/run下

--lock-path=/usr/local/nginx/lock/nginx \ #共享存储器互斥锁文件的路径

--with-http_ssl_module \ #启用 ngx_http_ssl_module 支持(使支持 https 请求,需已安装openssl)

--with-http_realip_module \ #启用 ngx_http_realip_module 支持(这个模块允许从请求标头更改客户端的 IP 地址值,默认为关)

--with-http_addition_module \ #启用 ngx_http_addition_module 支持(作为一个输出过滤器,支持不完全缓冲,分部分响应请求)

--with-http_sub_module \ #启用 ngx_http_sub_module 支持(允许用一些其他文本替换nginx 响应中的一些文本)

--with-http_dav_module \ #启用ngx_http_dav_module支持(增加PUT,DELETE,MKCOL:创建集合,COPY 和 MOVE 方法)默认情况下为关闭,需编译开启

--with-http_flv_module \ #启用 ngx_http_flv_module 支持(提供寻求内存使用基于时间的偏移量文件)

--with-http_gzip_static_module \ #启用 ngx_http_gzip_static_module 支持(在线实时压缩输出数据流)

--with-http_stub_status_module \ #启用ngx_http_stub_status_module支持(获取nginx自上次启动以来的工作状态)

--with-http_perl_module \ #Nginx配置能够扩展使用Perl代码。这个选项启用这个模块(然而使用这个模块会降低性能)

--with-mail \ #该选项用于启用mail模块,该模块默认没有被激活

--with-mail_ssl_module \ #为了代理任何一种类型的使用SSL/TLS的mail,激活该模块

--with-pcre \<br />
--http-client-body-temp-path=/var/tmp/nginx/client/ \ #从客户端收到请求后,该选项设置的目录用于作为请求体零食存放的目录,如果WebDAV模块启用,那么推荐设置该路径为同一文件系统上的目录作为最终的目的地

--http-proxy-temp-path=/var/tmp/nginx/proxy \ #在使用代理后,通过该选项设置存放临时文件路径

--http-fastcgi-temp-path=/var/tmp/nginx/fcgi \ #设置FastCGI临时文件的目录

--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ #设置uWSGI临时文件的目录

--http-scgi-temp-path=/var/tmp/nginx/scgi #设置SCGI临时文件的目录

以下是完整的复制

./configure --user=www --group=www --prefix=/usr/ --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --error-log-path=/var/log/nginx/nginx_error.log --http-log-path=/var/log/nginx/nginx_access.log --pid-path=/usr/local/nginx/run/nginx.pid --lock-path=/usr/local/nginx/lock/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_gzip_static_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi



网址导航