模块依赖性
gzip 模块需要 zlib 库
rewrite 模块需要 pcre 库
ssl 功能需要 openssl 库
预先编译好的安装包
Nginx在一些Linux发行版和BSD的各个变种版本的安装包仓库中都会有,通过各个系统自带的软件包管理方法即可安装。需要注意的是,很多预先编译好的安装包都比较陈旧,大多数情况下还是推荐直接从源码编译。
Ubuntu(Debian)软件包安装
http://wiki.ubuntu.org.cn/Nginx
Ubuntu(Debian)源码编译安装
1. 官方源码下载http://nginx.org
2. 解压缩
3. 编译安装
如:
* Ubuntu10.04安装openssl
执行如下操作来安装openssl及其开发函数库:
PCRE库安装
编译参数说明:
-
--prefix=path
— defines a directory that will keep server files. This same directory will also be used for all relative paths set byconfigure
(except for paths to libraries sources) and in thenginx.conf
configuration file. It is set to the/usr/local/nginx
directory by default.
Nginx安装路径。如果没有指定,默认为 /usr/local/nginx。
-
--sbin-path=path
— sets the name of an nginx executable file. This name is used only during installation. By default the file is namedprefix
/sbin/nginx
.
Nginx可执行文件安装路径。只能安装时指定,如果没有指定,默认为<prefix>/sbin/nginx。
-
--conf-path=path
— sets the name of annginx.conf
configuration file. If needs be, nginx can always be started with a different configuration file, by specifying it in the command-line parameter<nobr><code>-c<code><em>file</em></code></code></nobr>. By default the file is namedprefix
/conf/nginx.conf
.
在没有给定-c选项下默认的nginx.conf的路径。如果没有指定,默认为<prefix>/conf/nginx.conf。
-
--pid-path=path
— sets the name of an nginx.pid file that will store the process ID of the main process. After installation, the file name can always be changed in thenginx.conf
configuration file using thepiddirective. By default the file is namedprefix
/logs/nginx.pid
.
指定nginx.pid的文件名,安装后该名字可以在nginx.cong文件中修改。如果没有指定,默认为 <prefix>/logs/nginx.pid。
-
--error-log-path=path
— sets the name of the primary error, warnings, and diagnostic file. After installation, the file name can always be changed in thenginx.conf
configuration file using theerror_logdirective. By default the file is namedprefix
/logs/error.log
.
在nginx.conf中没有指定error_log指令的情况下,默认的错误日志的路径。如果没有指定,默认为 <prefix>/logs/error.log。
--http-log-path=path
— sets the name of the primary request log file of the HTTP server. After installation, the file name can always be changed in thenginx.conf
configuration file using theaccess_logdirective. By default the file is namedprefix
/logs/access.log
.
-
--user=name
— sets the name of an unprivileged user whose credentials will be used by worker processes. After installation, the name can always be changed in thenginx.conf
configuration file using theuserdirective. The default user name is nobody.
在nginx.conf中没有指定user指令的情况下,默认的nginx使用的用户。如果没有指定,默认为 nobody。
-
--group=name
— sets the name of a group whose credentials will be used by worker processes. After installation, the name can always be changed in thenginx.conf
configuration file using theuserdirective. By default, a group name is set to the name of an unprivileged user.
在nginx.conf中没有指定user指令的情况下,默认的nginx使用的组。如果没有指定,默认为 nobody。
--with-select_module
--without-select_module
— enables or disables building a module that allows the server to work with theselect()
method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, rtsig, or /dev/poll.
--with-poll_module
--without-poll_module
— enables or disables building a module that allows the server to work with thepoll()
method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, rtsig, or /dev/poll.
--without-http_gzip_module
— disables building a module thatcompresses responsesof an HTTP server. The zlib library is required to build and run this module.
-
--without-http_rewrite_module
— disables building a module that allows an HTTP server toredirect requests and change URI of requests. The PCRE library is required to build and run this module. The module is experimental— its directives may change in the future.
禁用 ngx_http_rewrite_module.
--without-http_proxy_module
— disables building an HTTP serverproxying module.
-
--with-http_ssl_module
— enables building a module that adds theHTTPS protocol supportto an HTTP server. This module is not built by default. The OpenSSL library is required to build and run this module.
开启HTTP SSL模块,使NGINX可以支持HTTPS请求。这个模块需要已经安装了OPENSSL
-
--with-pcre=path
— sets the path to the sources of the PCRE library. The library distribution (version 4.4— 8.21) needs to be downloaded from thePCREsite and extracted. The rest is done by nginx's ./configure and make. The library is required for regular expressions support in thelocationdirective and for thengx_http_rewrite_modulemodule.
指定PCRE库路径。(PCRE为正则表达式库)
--with-pcre-jit
— builds the PCRE library with “just-in-time compilation” support.
--with-zlib=path
— sets the path to the sources of the zlib library. The library distribution (version 1.1.3— 1.2.5) needs to be downloaded from thezlibsite and extracted. The rest is done by nginx's ./configure and make. The library is required for thengx_http_gzip_modulemodule.
--with-cc-opt=parameters
— sets additional parameters that will be added to the CFLAGS variable. When using the system PCRE library under FreeBSD,--with-cc-opt="-I /usr/local/include"
should be specified. If the number of files supported byselect()
needs to be increased it can also be specified here such as this:--with-cc-opt="-D FD_SETSIZE=2048"
.
--with-ld-opt=parameters
— sets additional parameters that will be used during linking. When using the system PCRE library under FreeBSD,--with-ld-opt="-L /usr/local/lib"
should be specified.
示例:
分享到:
相关推荐
资源内容:ubuntu 1804 nginx离线安装包 适用场景:无互联网环境的ubuntu 1804服务器的nginx离线部署 适用人群:运维,学习离线部署的学生 所需技能:常用的linux操作命令
ubuntu20.04无网dpkg安装nginx
Ubuntu中Nginx服务器安装配置教程
Ubuntu14.04.2下nginx1.6和sticky1.1模块的安装与简单配置,包括像文档和支持包
解压后 执行: dpkg -i *.deb 里面包含gcc make 和nginx
Ubuntu12.04 nginx python uwsgi Django安装步骤
ubuntu开机自启动nginx服务
ubuntu 20.04 离线安装Nginx(nginx-full_1.18.0)及相关依赖文件
Nginx 1.22.0 Linux 版本,解压安装。 Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型...
nbuntu下安装nginx,nbuntu下安装nginx,nbuntu下安装nginx,nbuntu下安装nginx
因为工作网络的特殊性,服务器是不连互联网的,所以整个安装过程都是采用离线包安装的方式来安装。 一般我们都需要先装pcre,zlib,前者用于url rewrite,后者用于gzip压缩,openssl用于后续可能升级到https时使用。
ubuntu自动安装nginx php脚本ubuntu自动安装nginx php脚本
ubuntu离线部署nginx+fastdfs软件包 autoconf-latest.tar.gz automake-1.15.tar.gz fastdfs-5.11.tar.gz fastdfs-nginx-module-1.20.tar.gz libfastcommon-1.0.38.tar.gz m4-1.4.18.tar.gz openssl-1.1.0j.tar.gz ...
由于服务器位于内网环境且无法访问互联网,需要离线安装nginx,ubuntu18.04离线安装软件也并不复杂,只是需要较大的耐心去搜集所需的包,不过大家不用担心,我已经为大家准备好了。 PCRE(Perl Compatible Regular ...
NULL 博文链接:https://kevin1.iteye.com/blog/902769
可以直接将nginx文件夹中所有deb文件拷贝在/var/cache/apt/archives中,离线安装,依据提示再安装其他,安装其他的时候可能会有嵌套依赖安装,安装指令sudo dpkg -i *.deb,安装过程都相同,安装后删除/var/cache/...
多次安装个人总结,按照说明书一步一步来,文件中有详细安装文档说明及需要的文件
linux下nginx离线安装包--附带所有依赖环境和安装教程,当linux无外网情况下,可通过此安装版安装,一次性解决所有依赖,按照压缩包内教程,即可从头到尾安装完毕
ubuntu安装tfs tfs-nginx的方法 ######################################################################################## tfs安装 1.降级安装gcc4.1.2 2.安装依赖包 3.安装tb-common-utils 4.安装TFS ########...
主要介绍了Ubuntu16.04.1 安装Nginx的方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。