ubuntu nginx安装
來源:http://blog.csdn.net/feng88724/article/details/7255714
模塊依賴性
gzip 模塊需要 zlib 庫 rewrite 模塊需要 pcre 庫 ssl 功能需要 openssl 庫預先編譯好的安裝包
Nginx在一些Linux發行版和BSD的各個變種版本的安裝包倉庫中都會有,通過各個系統自帶的軟件包管理方法即可安裝。需要注意的是,很多預先編譯好的安裝包都比較陳舊,大多數情況下還是推薦直接從源碼編譯。
Ubuntu(Debian)軟件包安裝
[plain]?view plaincopyprint?
http://wiki.ubuntu.org.cn/Nginx
1. 官方源碼下載?http://nginx.org
2. ?解壓縮
[plain]?view plaincopyprint?
3. 編譯安裝
如:
[plain]?view plaincopyprint?
*?Ubuntu10.04安裝openssl
執行如下操作來安裝openssl及其開發函數庫:
[plain]?view plaincopyprint?
PCRE庫安裝
[plain]?view plaincopyprint?
編譯參數說明:
-
--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?
參考:http://nginx.org/en/docs/install.html
總結
以上是生活随笔為你收集整理的ubuntu nginx安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux下vim中如何显示颜色或不显示
- 下一篇: Linux 从源码编译安装 OpenSS