SOURCE Compiler Installation Nginx

Source: Internet
Author: User

Install dependent software 1, install the compilation tool GCC

GCC is an open source compiler collection that handles a wide variety of languages: C, C + +, Java, Ada, etc., which are the most versatile compilers in the Linux world and support a large number of processors: x86, AMD64, PowerPC, ARM, MIPS, etc.
  
First determine if the system is installing GCC

[Email protected] ~]# gcc

If you output the following message, GCC is already installed:

If you output the following message, GCC is not installed:

To install GCC using the Package Manager Yum:

[[email protected] ~]# yum-y install GCC

2. Installing the Pcre Library

Nginx rewrite modules and HTTP core modules use the Pcre regular expression syntax, so nginx compilation requires the use of the Pcre (Perl Compatible Regular Expression) library. Need to install Pcre and Pcre-devel,pcre to provide a compiled version of the library, Pcre-devel provide the development phase of the header files and compile the project source code.
Install with Yum:

[Email protected] ~]# yum-y install pcre pcre-devel

If the system already has the Pcre package installed, it will output:

Nothing to do

That is, the system does not have Pcre installed or upgraded.

3. Installing the Zlib Library

The Zlib library provides compression algorithms that require gzip compression in various nginx modules, so you need to install the Zlib Library and Zlib-devel (zlib source code).

[Email protected] ~]# yum-y install zlib zlib-devel
4. Installing OpenSSL

The OpenSSL project is a collaborative development of robust, commercial-grade, fully-functional protocols for Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1), as well as a complete and robust universal cryptographic library . In Nginx, the OpenSSL library is used if the server needs to provide a secure Web page, so it needs to install its library file and its development installation package.
Yum installs OpenSSL and Openssl-devel

[Email protected] ~]# yum-y install OpenSSL openssl-devel
Installing Nginx

can go to the Nginx website to find the various versions of the link

Download and unzip:
[Email protected] src]# wget http://nginx.org/download/nginx-1.10.1.tar.gz
[Email protected] src]# tar zxvf nginx-1.10.1.tar.gz
[Email protected] src]# CD nginx-1.10.1

# #配置选项linux下创建一个应用程序分为三步, configure the source code, compile, install the compilation, configuration steps can choose more options, these options are not editable after the program installation is complete, the configuration is to add some switch to the configuration (configure) script, There are three types of switches that can be activated. ###** Easy Installation Method * * Without any configuration parameters directly compile the installation Nginx

[Email protected] src]#./configure
[[email protected] src]# Make&&make Install
Path Options

When you run the Configure script command, you may need to turn on some switch options, which may vary depending on the version being downloaded, using ./configure --help the list of valid switch options:

Path Options usage Default Value
–prefix Nginx Installation Location /usr/local/nginx
–sbin-path Nginx Binary Execution file path /sbin/nginx
–conf-path Configuration file storage location /conf/nginx.conf
–error-log-path Error log file location /logs/error.log
–pid-path PID file path /logs/nginx.pid (PID file contains the identifier of the process)
–lock-path Lock file Storage Path /logs/nginx.log (lock file is used to control the Nginx process is not started two times)
–with-perl_modules_path Perl module Path (you must define this parameter if you need to include additional Perl modules)
–with-perl Perl Execution File path
–http-log-path Access log file path /logs/access.log
–http-client-body-temp-path Temporary file path generated by client request /client_body_temp
–http-proxy-temp-path Proxy Storage Temp File path /proxy_temp_path
–http-fastcgi-temp-path Temporary file path used by HTTP fastcgi module
–builddir Create an application location
Prerequisites Options

The prerequisites are in the format of the library files and binaries, which need to be installed prior to configuration, and sometimes even if the software is installed on the system, sometimes the configuration scripts may not be able to locate them, so you can use the switches to indicate their paths.

compilation Options usage
–with-cc Specify the C compiler location
–with-cpp Specify alternate C preprocessing locations
–with-cc-opt Define additional options and pass to the C compiler at the command line
–with-ld-opt Define additional options and pass to the C connector on the command line
–with-cpu-opt Specify a different target processor structure, which can be the following values: Pentium, Pentiumpro, PPC64, etc.

pcre Options usage
–without-pcre Do not use the Pcre library ()
–with-pcre Force the use of Pcre
–with-pcre= ... Specify Pcre source code (note that it is not the installation directory)
–with-pcre-opt Additional options for building the Pcre library

MD5 Options usage
–with-md5= ... Specify the MD5 library source code path
–with-md5-opt Additional options for building the MD5 library
–with-md5-asm Build MD5 Library using assembly language source code

SHA1 Options usage
–with-sha1= ... Source code Path
–with-sha1-opt Additional options for building the SHA1 library
–with-sha1-asm Build SHA1 Library using assembly language source code

zlib Options usage
–with-zlib Source code Path
–with-zlib-opt Additional options for building the Zlib library
–with-zlib-asm Use assembly language to maximize the optimization of the following target structures: Pentium, Pentiumpro

OpenSSL options usage
–with-openssl Source code Path
–with-openssl-opt Additional options for setting up the OpenSSL library

Module Options

You need to select a module before compiling nginx, some modules are turned on by default, and some modules need to be opened manually.

Disable module by default Description
–without-http_charset_module Disables the CharSet module, which is used to re-encode Web pages
–without-http_gzip_module Disable GZIP compression module
–without-http_ssi_module Disabling the server-side include module
–without-http_userid_module Disables the user ID module, which authenticates the user through a cookie
–without-http_access_module Disable access module, allow access to configuration for specified IP segment
–without-http_auth_basic_module Disabling the Basic authentication module
–without-http_autoindex_module Disable automatic indexing module
–without-http_geo_module Disables the GEO module, which allows you to define variables that depend on the IP address segment
–without-http_map_module Disables the map module, which allows you to define the map segment
–without-http_referer_module Disabling the Referer control module
–without-http_rewrite_module Disabling the rewrite module
–without-http_proxy_module Disables the proxy module, which is used to transfer requests to other servers
–without-http_fastcgi_module Disables the FastCGI module, which is used to work with the fastcgi process
–without-http_memcached_module Disabling the memcached module
–without-http_limit_req_module Disable the Limit request module, which allows you to limit the total number of requests per user
–without-http_empty_gif_module Disables the empty GIF module, which is used to provide a blank GIF image in memory
–without-http_browser_module Disables the browser module, which is used to interpret the user-agent string
–without-http_upstream_ip_hash_module Disable the upstream module, which is used to configure the load balancing structure

Default Open Module Description
–with-http_ssl_module Enable the SSL module to support Web pages that use the HTTPS protocol
–with-http_realip_module Turn on real IP support, which is used to read the real IP address from the user's request header data
–with-http_addition_module Open the addition module, which allows you to append or prepend data to the body part of the response
–with-http_xslt_module Turn on the Xlst module, which implements the Xlst conversion to an XML document
–with-http_image_filter_module Turn on the image filter module, which allows you to modify images (note: If you compile the module, you need to install the LIBGD library)
–with-http_geoip_module Turn on the GeoIP module, which obtains the geographic distribution of the client by using the Maxmind ' s GEOI binary database (note: If you want to compile the module, you need to install Libgeoip)
–with-http_sub_module Opens the substitution module, which is used to replace text in a Web page
–with-http_dav_module
–with-http_flv_module Opens the FLV module, which is used to process. FLV (Flash Video) files
–with-http_gzip_static_module Turn on the gzip static module, which is used to send pre-compressed files
–with-http_random_index_module Opens the random index module, which is used to pick a random file as the index of the directory
–with-http_secure_link_module Open the Secure link module, which is used to detect the presence of a keyword in a URL
–with-http_stub_status_module Opens the stub status module, which generates a server Status and Information page
–with-google_perftools_module Turn on Google performance tools
Miscellaneous
Mail Service agent Description
–with-mail Opens the Service proxy module (mail server proxy) and supports POP3,IMAP4 and SMTP, which is disabled by default
–with-mail_ssl_module Turn on SSL support for the Mail agent service, which is disabled by default
–without-mail_pop3_module The Mail agent module disables the POP3 feature, which is enabled by default after the Mail agent module is turned on
–without-mail_imap_module The Mail agent module disables the IMAP4 feature, which is enabled by default after the Mail agent module is turned on
–without-mail_smtp_module The Mail agent module disables the SMTP feature, which is enabled by default after the Mail agent module is turned on

Event Management (select an event notification system for Nginx timers) Description
–with-select_module Open the Select module and use select as the event notification mechanism, which is enabled by default
–without-select_module Disable Select module
–with-poll_module Turn on the poll module, use poll as the event notification mechanism, turn on by default
–without-poll_module Disabling the poll module

User and Group options Description
–user= ... Specify the default user to start the Nginx process
–group= ... Specify the default user group to start the Nginx process

Other Options Description
–with-ipv6 Turn on IPv6 support
–without-http Disabling the HTTP service
–without-http-cache Disable the HTTP buffering feature
–add-module Add a third-party module through the specified path compilation, which can be used multiple times if you need to compile multiple modules
–with-debug Turn on recording additional debugging information
Configure possible error issues

You may get an error when you run the Configure command, in most cases due to missing prerequisites or no path or directory permissions specified, you can view objs/autoconf.err File to view compilation error issues.

Compile

Once the configuration is successful, the Nginx can be compiled and executed in the source code directory:

[[email protected] src] #make

After a successful compilation, the following information is output:

MAKE[1]: Leaving directory '/usr/local/src/nginx-1.10.1 '

The compilation process may be an error, the cause of the error may not find a prerequisite or the specified path is invalid, if this is the case, you can check the switch options and paths, re-execute configure compilation. It is also possible that the cause of the error is the download of the newer Nginx version, the new version is not very good backward compatibility, so that you can download the older stable version to try again.

Installation

Execute the Install command after successful compilation:

[[email protected] src] #make &&make Install

---------------------Zsl10 Source: CSDN Original: 52181748?utm_source=copy copyright notice: This article for Bo Master original article, reprint please attach blog link!

SOURCE Compiler Installation Nginx

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.