Ubuntu installation Nginx (copy)

Source: Internet
Author: User
Tags epoll install openssl openssl openssl library

GCC, g++ dependent libraries
apt-get install build-essentialapt-get install libtool  
Installing Pcre Dependent libraries (http://www.pcre.org/)
sudo apt-get install libpcre3 Libpcre3-dev

or source installation:

cd/usr/local/srcwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz TAR-ZXVF pcre-8.37. TAR.GZCD pcre-8.34./Configuremakemake Install
Installing zlib dependent libraries (http://www.zlib.net)
apt-get install Zlib1g-dev

or source Installation

cd/usr/local/srcwget http://Zlib.net/zlib-1.2.8.tar.gzsudo TAR-ZXVF zlib-1.2.  8. TAR.GZCD zlib-1.2.  8sudo./configuresudo makesudo make install         
Install SSL dependent libraries (ubuntu16.04 LTS has been installed)
apt-get install OpenSSL
Installing Nginx
cd/usr/local/Srcwget http://NGINX.ORG/DOWNLOAD/NGINX-1.4.2.TAR.GZTAR-ZXVF nginx-1.4.2.TAR.GZCD nginx-< Span style= "COLOR: #800080" >1.4. 2/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=/ Opt/app/openet/oetal1/chenhe/pcre-8.37--with-zlib=/ Opt/app/openet/oetal1/chenhe/zlib-1.2. 8--with-openssl=/opt/app/openet/oetal1/chenhe/openssl- 1.0.1t makemake install      
  • --prefix=pathDefine a directory that stores files on the server, which is the installation directory of Nginx. Default usage/usr/local/nginx。
  • --sbin-path=pathSets the path of the Nginx executable file, which defaults to prefix/sbin/nginx .
  • --conf-path=pathSet the path to the nginx.conf configuration file. Nginx allows you to start with a different configuration file via the-C option on the command line. The default is prefix/conf/nginx.conf .
  • --pid-path=path  设置nginx.pid文件,将存储的主进程的进程号。安装完成后,可以随时改变的文件名 , 在nginx.conf配置文件中使用 PID指令。默认情况下,文件名 为prefix/logs/nginx.pid.
  • --error-log-path=pathSets the name of the primary error, warning, and diagnostic file. After the installation is complete, you can change the file name at any time, using the Error_log directive in the nginx.conf configuration file. By default, the file name is prefix/logs/error.log .
  • --http-log-path=pathSets the name of the log file for the HTTP server for the primary request. After the installation is complete, you can change the file name at any time, using the Access_log directive in the nginx.conf configuration file. By default, the file name is prefix/logs/access.log .
  • --user=nameThe user who set the Nginx worker process. After the installation is complete, you can change the name of the user directive that is used in the nginx.conf configuration file at any time. The default user name is nobody.
  • --group=nameSets the user group for the Nginx worker process. After the installation is complete, you can change the name of the user directive that is used in the nginx.conf configuration file at any time. The default is non-privileged users.
  • --with-select_module--without-select_module 启用或禁用构建一个模块来允许服务器使用select()方法。该模块将自动建立,如果平台不支持的kqueue,epoll,rtsig或/dev/poll。
  • --with-poll_module--without-poll_moduleEnables or disables building a module to allow the server to use the poll () method. The module will be created automatically if the platform does not support Kqueue,epoll,rtsig or/dev/poll.
  • --without-http_gzip_module-Do not compile the response module of the compressed HTTP server. Compiling and running this module requires a zlib library.
  • --without-http_rewrite_moduleThe rewrite module is not compiled. Compiling and running this module requires PCRE library support.
  • --without-http_proxy_module-Do not compile the Http_proxy module.
  • --with-http_ssl_module-Use the HTTPS protocol module. By default, the module is not built. It is necessary to establish and run the OpenSSL library for this module.
  • --with-pcre=path-Set the source path of the Pcre library. The source code of the Pcre Library (version 4.4-8.30) needs to be downloaded and decompressed from the Pcre website. The rest of the work is nginx./configure and make to complete. Regular expressions are used in the location directive and in the Ngx_http_rewrite_module module.
  • --with-pcre-jit-compilation Pcre contains "Just-in-time compilation" (1.1.12, Pcre_jit instructions).
  • --with-zlib=path-Set the source path of the zlib library. To download and unzip from zlib (version 1.1.3-1.2.5). The rest of the work is nginx./configure and make complete. The Ngx_http_gzip_module module requires the use of zlib.
  • --with-cc-opt=parameters-Set additional parameters to be added to the cflags variable. For example, when you use the Pcre library on FreeBSD, you need to use: --with-cc-opt="-I /usr/local/include。 . Add as needed select()支持的文件数量 :--with-cc-opt="-D FD_SETSIZE=2048".
  • --with-ld-opt=parameters-Set additional parameters that will be used during the link. For example, when using the Pcre Library of the system under FreeBSD, you should specify:--with-ld-opt="-L /usr/local/lib".

Start, stop, reload configuration, test configuration file is correct
sudo/usr/local/nginx    #启动
Or
Sudo/usr/local/nginx-c/usr/local/nginx.conf



Sudo/usr/local/nginx-s Reload #重载配置文件

Reference:

http://nginx.org/en/docs/configure.html Nginx Official website (Building nginx from Sources)
http://nginx.org/official website
Http://www.nginx.cn/install
Http://www.cnblogs.com/piscesLoveCc/p/5794926.html

Ubuntu installation Nginx (copy)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.