来源:http://blog.csdn.net/feng88724/article/details/7255714

模块依赖性

  gzip 模块需要 zlib 库   rewrite 模块需要 pcre 库   ssl 功能需要 openssl 库

预先编译好的安装包

  Nginx在一些Linux发行版和BSD的各个变种版本的安装包仓库中都会有,通过各个系统自带的软件包管理方法即可安装。需要注意的是,很多预先编译好的安装包都比较陈旧,大多数情况下还是推荐直接从源码编译。

Ubuntu(Debian)软件包安装

[plain] view plaincopyprint?
  1. apt-get update
  2. apt-get install nginx

http://wiki.ubuntu.org.cn/Nginx

Ubuntu(Debian)源码编译安装

1. 官方源码下载 http://nginx.org

2.  解压缩

[plain] view plaincopyprint?
  1. tar zxvf nginx-1.0.12.tar.gz

3. 编译安装

如:

[plain] view plaincopyprint?
  1. ./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --with-http_ssl_module

* Ubuntu10.04安装openssl
执行如下操作来安装openssl及其开发函数库:

[plain] view plaincopyprint?
  1. $ sudo apt-get install openssl
  2. $ sudo apt-get install libssl0.9.8
  3. $ sudo apt-get install libssl-dev

PCRE库安装

[plain] view plaincopyprint?
  1. sudo apt-get update
  2. sudo apt-get install libpcre3 libpcre3-dev

编译参数说明:

  • --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 the nginx.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 an nginx.conf configuration file. If needs be, nginx can always be started with a different configuration file, by specifying it in the command-line parameter -c file. By default the file is named prefix/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 the nginx.conf configuration file using the pid directive. 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 the nginx.conf configuration file using the error_log directive. 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 the nginx.conf configuration file using the access_log directive. 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 the nginx.conf configuration file using the user directive. 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 the nginx.conf configuration file using the user directive. 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 the select() 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 the poll() 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 that compresses responses of 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 to redirect 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 server proxying module.

  • --with-http_ssl_module — enables building a module that adds the HTTPS protocol support to 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 the PCRE site and extracted. The rest is done by nginx's ./configure and make. The library is required for regular expressions support in the location directive and for the ngx_http_rewrite_module module.

    指定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 the zlib site and extracted. The rest is done by nginx's ./configure and make. The library is required for thengx_http_gzip_module module.

  • --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 by select()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.

示例:

[plain] view plaincopyprint?
  1. ./configure
  2. --sbin-path=/usr/local/nginx/nginx
  3. --conf-path=/usr/local/nginx/nginx.conf
  4. --pid-path=/usr/local/nginx/nginx.pid
  5. --with-http_ssl_module
  6. --with-pcre=../pcre-4.4
  7. --with-zlib=../zlib-1.1.3
参考:http://nginx.org/en/docs/install.html

ubuntu nginx安装相关推荐

  1. ubuntu nginx 安装和启动和自启动

    ngx_http_core_module 模块http://tengine.taobao.org/nginx_docs/cn/docs/http/ngx_http_core_module.html 目 ...

  2. ubuntu nginx安装php mysql,ubuntu下配置nginx+php+mysql详解

    1.更新 复制代码 代码如下: sudo apt-get update 2.安装nginx 复制代码 代码如下: sudo apt-get intsall nginx Ubuntu安装之后的文件结构大 ...

  3. Ubuntu Nginx安装使用

    安装Nginx apt-get install nginx nginx -v # 查看版本 "nginx version: nginx/1.21.0" service nginx ...

  4. ubuntu nginx安装完成无法解析php解决方法

    安装完成nginx后,发现无法解析php代码,现在解决方案如下 方法一 找到nginx配制文件,如图下添加配制(截图画出来的),我的配制文件位置是/etc/nginx/sites-available/ ...

  5. ubuntu nginx 安装多个php版本

    当我们项目要使用不同的php版本的时候,我们要配制每个项目的php版本,方法如下 安装多个php版本,同时也要安装php7.4-fpm  或php7.0-fpm,安装完成后,找到每个php版本的php ...

  6. 挑战一个人搭建一套完整直播系统1:Nginx安装

    本章开始将介绍如何搭建一套完整的直播系统,首先介绍Nginx的安装,操作系统使用的是Ubuntu Nginx安装 1.下载安装包到指定目录 wget http://nginx.org/download ...

  7. Ubuntu下安装Nginx,PHP5(及PHP-FPM),MySQL

     Ubuntu下安装Nginx,PHP5(及PHP-FPM),MySQL 2012-09-15 11:12:31 标签:php mysql ubuntu nginx php-fpm 原创作品,允许转载 ...

  8. Ubuntu上安装nginx步骤及问题记录

    在Ubuntu上安装nginx,步骤如下:      1. 向/etc/apt/sources.list增加Nginx的源      2.执行sudo apt-get update更新软件源     ...

  9. ubuntu编译安装php5 mysql nginx

    一.首先下载软件源码包 wget http://sysoev.ru/nginx/nginx-0.8.53.tar.gz wget http:/.s135.com/soft/linux/nginx_ph ...

最新文章

  1. 深入浅出的讲解傅里叶变换(完整)
  2. uncompressing linux .................................................后没反应解决办法
  3. 修改注册表真正的提高网速
  4. Keil进入仿真,窗口不显示程序运行箭头
  5. Redis【第二篇】集群搭建
  6. Hystrix和ribbon的超时时长准确配置的理论依据
  7. 让VS Code 支持 Jupyter Notebook
  8. 从零开始实现数据结构(一) 动态数组
  9. 【报告分享】美好城市指数:短视频与城市繁荣关系白皮书.pdf(附下载链接)...
  10. 二路归并排序 代码实例
  11. 软件工程2第一次作业
  12. 排序算法之六 堆排序(C++版本)
  13. Java中流的使用和说明(二)
  14. windows版redis安装教程
  15. 在OC项目下实现SwiftMonkey
  16. [Swift]LeetCode1031. 两个非重叠子数组的最大和 | Maximum Sum of Two Non-Overlapping Subarrays...
  17. matlab ax=b x=,matlab 求解 Ax=B 时所用算法
  18. Windows简体系统和繁体系统下的乱码处理
  19. 自己编写的MyXMindUtils(XMind转json串)
  20. 图论 北师大 张秀平 自学 视频 NOIP

热门文章

  1. 【转】GPS误差来源
  2. 提高SQLITE 大数据量操作效率的方法
  3. 用汇编的眼光看C++(之拷贝、赋值函数)
  4. oracle客户端安装后,oracle客户端安装
  5. codeigniter mysql error_CodeIgniter:无法使用提供的设置错误消息连接到数据库服务器...
  6. 如何在vue-cli3中使用tinymce
  7. 计算机的教学中作用是什么,发挥计算机在教学中应有的作用
  8. django html 模板继承,Django模板的继承
  9. java nio is例子,Java Buffer isDirect()用法及代码示例
  10. bufferedreader接收不到数据_PS4、Xbox手柄和Switch跨次元组队?全靠八位堂USB无线接收器...