nginx安装笔记
Linux安装过程:
For Ubuntu 10.04 and newer:
sudo su -
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt-get update
apt-get install nginx
For older Ubuntu versions (9.10 and earlier):
sudo su -
nginx=stable # use nginx=development for latest development version
echo "deb http://ppa.launchpad.net/nginx/$nginx/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/nginx-$nginx-$(lsb_release -cs).list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C
apt-get update
apt-get install nginx
WINDOW 32位安装过程:
Installation:
cd c:\
unzip nginx-0.x.x.zip
ren nginx-0.x.x nginx
cd nginx
start nginx
Control:
nginx -s [ stop | quit | reopen | reload ]
源码安装:
./configure
make
sudo make install
配置选项:
--prefix=<path> - The path relative to which all other Nginx paths will resolve. If not specified, defaults to /usr/local/nginx.
--sbin-path=<path> - The path to the nginx executable. Only used for installation. If not specified defaults to <prefix>/sbin/nginx.
--conf-path=<path> - The default location of nginx.conf if no -c parameter is provided. If not provided, defaults to <prefix>/conf/nginx.conf.
--pid-path=<path> - The path to nginx.pid, if not set via the "pid" directive in nginx.conf. If not provided, defaults to <prefix>/logs/nginx.pid.
--lock-path=<path> - The path to the nginx.lock file. If not provided, defaults to <prefix>/logs/nginx.lock.
--error-log-path=<path> - The location of the error log if not set via the "error_log" in nginx.conf. If not set, defaults to <prefix>/logs/error.log.
--http-log-path=<path> - The location of the access log if not set via the "access_log" directive in nginx.conf. If not set, defaults to <prefix>/logs/access.log.
--user=<user> - The default user that nginx will run as if not set in nginx.conf via the "user" directive. If not set, defaults to "nobody".
--group=<group> - The default group that nginx will run under if not set via the "user" directive in nginx.conf. If not set defaults to "nobody".
--builddir=DIR - Set the build directory
--with-rtsig_module - Enable rtsig module
--with-select_module --without-select_module - Whether or not to enable the select module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.
--with-poll_module --without-poll_module - Whether or not to enable the poll module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.
--with-http_ssl_module - Enable ngx_http_ssl_module. Enables SSL support and the ability to handle HTTPS requests. Requires OpenSSL. On Debian, this is libssl-dev.
--with-http_realip_module - Enable ngx_http_realip_module
--with-http_addition_module - Enable ngx_http_addition_module
--with-http_sub_module - Enable ngx_http_sub_module
--with-http_dav_module - Enable ngx_http_dav_module
--with-http_flv_module - Enable ngx_http_flv_module
--with-http_stub_status_module - Enable the "server status" page
--without-http_charset_module - Disable ngx_http_charset_module
--without-http_gzip_module - Disable ngx_http_gzip_module. Requires zlib if enabled.
--without-http_ssi_module - Disable ngx_http_ssi_module
--without-http_userid_module - Disable ngx_http_userid_module
--without-http_access_module - Disable ngx_http_access_module
--without-http_auth_basic_module - Disable ngx_http_auth_basic_module
--without-http_autoindex_module - Disable ngx_http_autoindex_module
--without-http_geo_module - Disable ngx_http_geo_module
--without-http_map_module - Disable ngx_http_map_module
--without-http_referer_module - Disable ngx_http_referer_module
--without-http_rewrite_module - Disable ngx_http_rewrite_module. Requires PCRE if enabled.
--without-http_proxy_module - Disable ngx_http_proxy_module
--without-http_fastcgi_module - Disable ngx_http_fastcgi_module
--without-http_memcached_module - Disable ngx_http_memcached_module
--without-http_limit_zone_module - Disable ngx_http_limit_zone_module
--without-http_empty_gif_module - Disable ngx_http_empty_gif_module
--without-http_browser_module - Disable ngx_http_browser_module
--without-http_upstream_ip_hash_module - Disable ngx_http_upstream_ip_hash_module
--with-http_perl_module - Enable ngx_http_perl_module
--with-perl_modules_path=PATH - Set path to the perl modules
--with-perl=PATH - Set path to the perl binary
--http-client-body-temp-path=PATH - Set path to the http client request body temporary files. If not set, defaults to <prefix>/client_body_temp
--http-proxy-temp-path=PATH - Set path to the http proxy temporary files. If not set, defaults to <prefix>/proxy_temp
--http-fastcgi-temp-path=PATH - Set path to the http fastcgi temporary files. If not set, defaults to <prefix>/fastcgi_temp
--without-http - Disable HTTP server
--with-mail - Enable IMAP4/POP3/SMTP proxy module
--with-mail_ssl_module - Enable ngx_mail_ssl_module
--with-cc=PATH - Set path to C compiler
--with-cpp=PATH - Set path to C preprocessor
--with-cc-opt=OPTIONS - Additional parameters which will be added to the variable CFLAGS. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-cc-opt="-I /usr/local/include". If we are using select() and it is necessary to increase the number of file descriptors, then this also can be assigned here: --with-cc-opt="-D FD_SETSIZE=2048".
--with-ld-opt=OPTIONS - Additional parameters passed to the linker. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-ld-opt="-L /usr/local/lib".
--with-cpu-opt=CPU - Build for specified CPU, the valid values: pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, ppc64
--without-pcre - Disable PCRE library usage. Also disables HTTP rewrite module. PCRE is also required for regular expressions in "location" directive.
--with-pcre=DIR - Set path to PCRE library sources.
--with-pcre-opt=OPTIONS - Set additional options for PCRE building.
--with-md5=DIR - Set path to md5 library sources.
--with-md5-opt=OPTIONS - Set additional options for md5 building.
--with-md5-asm - Use md5 assembler sources.
--with-sha1=DIR - Set path to sha1 library sources.
--with-sha1-opt=OPTIONS - Set additional options for sha1 building.
--with-sha1-asm - Use sha1 assembler sources.
--with-zlib=DIR - Set path to zlib library sources.
--with-zlib-opt=OPTIONS - Set additional options for zlib building.
--with-zlib-asm=CPU - Use zlib assembler sources optimized for specified CPU, valid values are: pentium, pentiumpro
--with-openssl=DIR - Set path to OpenSSL library sources
--with-openssl-opt=OPTIONS - Set additional options for OpenSSL building
--with-debug - Enable debug logging
--add-module=PATH - Add in a third-party module found in directory PATH
配置例子:
./configure \ --sbin-path=/usr/local/nginx/nginx \ --conf-path=/usr/local/nginx/nginx.conf \ --pid-path=/usr/local/nginx/nginx.pid \ --with-http_ssl_module \ --with-pcre=../pcre-4.4 \ --with-zlib=../zlib-1.1.3