Linux Learning: nginx--Introduction and Installation-01

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

First, Introduction

What is 1.1 Nginx?

Nginx is a lightweight Web server, but also a lightweight reverse proxy server

What 1.2 nginx can do

A. Direct support for rails and PHP programs

b, as an HTTP reverse proxy server

C, as a load balancer server

D, as the Mail proxy server

E, help to implement the prefix dynamic static separation

.....

1.3 Nginx Features

High stability, high performance, less resource-intensive, feature-rich, modular architecture, support for hot deployment

Second, installation

Pre-conditions:

Reminders:

Please first check the/usr/bin under the GCC and make file is not empty, empty please uninstall first, I just because there is no uninstall, so there are many pits ...

A, need gcc, the system comes with, no, need to install first

View:

Rpm-qa|grep GCC

Installation:

Yum install gcc gcc-c++ autoconf autmake libtool make

b, need pcre, install the command as follows:

Yum Install pcre*

c, need zlib, install the command as follows:

Yum Install zlib Zlib-devel

D, if you need to support SSL, install OpenSSL, the installation command is as follows:

Yum Install OpenSSL Openssl-devel

E, http://nginx.org/to download the source package

Installation:

1th Step:

A, decompression into the/opt, into the Nginx directory

B, installation

./configure--prefix=/usr/local/nginx--with-http_stub_status_module

Description

--prefix: Installation path

--with: Configuration options

Abnormal:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/7E/wKiom1jg_ASjl3x3AAA1291enb0916.png "title=" 111. PNG "alt=" Wkiom1jg_asjl3x3aaa1291enb0916.png "/>

Workaround: Uninstall GCC first

        [[email protected] ~]# rpm -qa gcc         gcc-4.4.7-17.el6.x86_64         [[email protected] ~]# rpm -e gcc-4.4.7-17.el6.x86_64         error: Failed dependencies:    gcc =  4.4.4 is needed by  (installed)  libtool-2.2.6-15.5.el6.x86_64         [[email protected] ~]# rpm -e libtool-2.2.6-15.5.el6.x86_64         [[email protected] ~]# rpm -qa gcc         [[email protected] nginx-1.10.3]# gcc         -bash: /usr/bin/gcc: No such file or  Directory

Uninstall succeeded

To install GCC again:

Yum install gcc gcc-c++ autoconf autmake libtool make

Enter the Nginx directory to install

./configure--prefix=/usr/local/nginx--with-http_stub_status_module

Success:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8F/7F/wKiom1jhGnPgeY-RAABXE7mgiLE582.png "title=" 111. PNG "alt=" Wkiom1jhgnpgey-raabxe7mgile582.png "/>

2nd step: Make, make install

Exception: No information

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/7F/wKiom1jhG3jT-R7EAAAHShy_Ltw157.png "title=" 11. PNG "alt=" Wkiom1jhg3jt-r7eaaahshy_ltw157.png "/>

Look for make under/usr/bin and find it empty:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8F/7D/wKioL1jhG9-DW985AAAtN2fz-00199.png "title=" 111. PNG "alt=" Wkiol1jhg9-dw985aaatn2fz-00199.png "/>

Uninstall make:

[Email protected] nginx-1.10.3]# RPM-QA make make-3.81-23.el6.x86_64 [[email protected] nginx-1.10.3]# rpm -e--allmatches--nodeps make-3.81-23.el6.x86_64 install-info:/usr/share/info/make.info.gz:empty file [[E Mail protected] nginx-1.10.3]# rpm-qa make [[email protected] nginx-1.10.3]#

Install Make:

Yum-y Install Libtool make

Make successful.

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8F/7D/wKioL1jhISqCabo2AAAvVZriOQE351.png "title=" 111. PNG "alt=" Wkiol1jhisqcabo2aaavvzrioqe351.png "/>

Make install succeeded.

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8F/7F/wKiom1jhIaTAyB4LAAAxIn1fix4900.png "title=" 111. PNG "alt=" Wkiom1jhiatayb4laaaxin1fix4900.png "/>

3rd Step: Start the test

Go to the Sbin directory under the installation directory:

Cd/usr/local/nginx/sbin

To test the configuration file:

./nginx-t

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8F/7F/wKiom1jhI0iSM32aAAAbAGYI89I473.png "title=" 111. PNG "alt=" Wkiom1jhi0ism32aaaabagyi89i473.png "/>

Start: Default is 80 port

[Email protected] sbin]#./nginx

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8F/7D/wKioL1jhJA6DZo7qAABqfFhp7V0625.png "title=" 11. PNG "alt=" Wkiol1jhja6dzo7qaabqffhp7v0625.png "/>

Stop:./nginx-s stop or./nginx-s quit

Restart:./nginx-s Reload

To view a process:

[Email protected] sbin]# Ps-ef |        grep nginx root 16984 1 0 20:15?        00:00:00 nginx:master process./nginx Nobody 16985 16984 0 20:15? 00:00:00 Nginx:worker Process root 16990 1405 0 20:21 pts/0 00:00:00 grep nginx



Nginx Installation configuration options:

--prefix=<path>

The installation path, if not specified, defaults to/usr/local/nginx.

--sbin-path=<path>

Nginx executable command of the file, if not specified, the default is <prefix>/sbin/nginx.

--conf-path=<path>

The default location for nginx.conf is not specified with the-c parameter, and if not specified, the default is <prefix>/conf/nginx.conf.

--pid-path=<path>

The path of the nginx.pid, if not specified by the "pid" directive in nginx.conf, defaults to <prefix>/logs/nginx.pid.

--lock-path=<path>

The Nginx.lock file path, if not specified, defaults to <prefix>/logs/nginx.lock.

--error-log-path=<path>

When there is no error log location specified in nginx.conf using the "error_log" directive, the default is <prefix>/logs/error.log if not specified.

--http-log-path=<path>

When there is no access log location specified in nginx.conf using the "access_log" directive, the default is <prefix>/logs/access.log if not specified.

--user=<user>

When there is no user specified in nginx.conf with the "user" directive, the default is "Nobody" if not specified.

--group=<group>

The default is "nobody" when there is no set of Nginx running in nginx.conf with the "user" instruction specified.

--builddir=dir

Set up the build directory.

--with-rtsig_module

Enable the Rtsig module.

--with-select_module–without-select_module

If you do not see Kqueue, Epoll,rtsig or/dev/poll one of the Configure, select modules are always enabled.

--with-poll_module–without-poll_module

If you do not see Kqueue, Epoll,rtsig or/dev/poll one of the Configure, the poll module is always enabled.

--with-http_ssl_module

Enable Ngx_http_ssl_module, enable SSL support, and be able to handle HTTPS requests. OpenSSL is required, and the corresponding package is libssl-dev in the Debian system.

--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 (Service state) page

--without-http_charset_module

Disable Ngx_http_charset_module

--without-http_gzip_module

Disabling Ngx_http_gzip_module, if enabled, requires the Zlib package.

--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

Disables Ngx_http_rewrite_module. If enabled, the Pcre package is required.

--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 the path for the Perl module

--with-perl=path

Set the path for the Perl library

--http-client-body-temp-path=path

Sets the path for the request entity temporary file for the HTTP connection, and defaults to <prefix>/client_body_temp if not specified

--http-proxy-temp-path=path

Sets the path for the HTTP proxy temp file, and defaults to <prefix>/proxy_temp if not specified

--http-fastcgi-temp-path=path

Sets the path for the HTTP fastcgi temp file, if not specified, the default is <prefix>/fastcgi_temp

--without-http

Disabling the HTTP service

--with-mail

Enable the IMAP4/POP3/SMTP proxy module

--with-mail_ssl_module

Enable Ngx_mail_ssl_module

--with-cc=path

Set C compiler path

--with-cpp=path

Setting the C preprocessor path

--with-cc-opt=options

The additional parameters in the variable cflags, used for the Pcre library in FreeBSD, also need to specify –with-cc-opt= "-i/usr/local/include", and if we use the Select () function, we need to increase the number of file descriptors simultaneously, which can be done by- With-cc-opt= "-D fd_setsize=2048" designation.

--with-ld-opt=options

With the additional parameters of the connector for the Pcre library in FreeBSD, it is also necessary to specify –with-ld-opt= "-l/usr/local/lib".

--with-cpu-opt=cpu

Specifies the compiled CPU, the available values are: Pentium, Pentiumpro, pentium3, Pentium4,athlon, Opteron, AMD64, Sparc32, SPARC64, PPC64

--without-pcre

Disable the Pcre library file while the HTTP rewrite module is disabled, and if you want to use regular expressions in the location directive, you also need to pcre the library.

--with-pcre=dir

Sets the Pcre library source file path.

--with-pcre-opt=options

Set additional parameters for Pcre at compile time.

--with-md5=dir

Sets the MD5 library source file path.

--with-md5-opt=options

Set additional parameters for MD5 at compile time.

--with-md5-asm

Use the MD5 assembly source.

--with-sha1=dir

Sets the SHA1 library source file path.

--with-sha1-opt=options

Set additional parameters for SHA1 at compile time.

--with-sha1-asm

Use the SHA1 assembly source.

--with-zlib=dir

Sets the zlib library source file path.

--with-zlib-opt=options

Set additional parameters for zlib at compile time.

--with-zlib-asm=cpu

Optimized for the specified CPU using the zlib assembler source, the available values are: Pentium, Pentiumpro.

--with-openssl=dir

Sets the path of the OpenSSL library source file.

--with-openssl-opt=options

Set additional parameters for OpenSSL at compile time.

--with-debug

Enable debug logging.

--add-module=path

Add a third-party module in path.

This article is from "I Love Big gold" blog, please be sure to keep this source http://1754966750.blog.51cto.com/7455444/1912629

Linux Learning: nginx--Introduction and Installation-01

Related Article

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.