Linux installation configuration Nginx

Source: Internet
Author: User

Brief introduction:

Nginx is a lightweight Web server/reverse proxy server and e-mail (IMAP/POP3) proxy server that is released under a bsd-like protocol. Developed by Russian program designer Igor Sysoev for use in Russian large portals and search engine Rambler (Russian: Рамблер). It is characterized by the possession of less memory, concurrency is strong, in fact, nginx concurrency is actually in the same type of Web server performance better.

Marking:

Linux needs to configure the network Yum Source to make sure that Yum installs the package, which makes it easy to install a portion of the dependency package during the test.

Configure the 163 netease hint network yum source Reference blog: http://www.cnblogs.com/zoulongbin/p/5773330.html

Nginx Installation Action:

1, go to nginx official website to download the corresponding version of the source installation package http://nginx.org/download/. (In Linux you can use the command directly wget–p/home/package http://nginx.org/download/nginx-1.7.0.tar.gz)

2, decompression nginx-1.7.0.tar.gz compression package.

3. Run the./configure--prefix=/usr/local/nginx detection program file. (--prefix=/usr/local/nginx specifies the installation path)

4, the detection program files found missing gcc and gcc-c++ dependent packages, need to install before you can compile and install.

5. Use yum-y install GCC gcc-c++ for online installation.

6. Execute again./configure--prefix=/usr/local/nginx Detection program file found missing Pcre-devel dependency package.

7, using yum-y install Pcre-devel for online installation.

8. Execute again./configure--prefix=/usr/local/nginx detection Program Files found missing zlib and zlib-devel dependent packages.

9, using yum-y install zlib zlib-devel for online installation.

10. Re-execute./configure--prefix=/usr/local/nginx Detection program file Discovery detection passed.

11. Execute command make compile. (Make is the process of writing the source code files in various languages into executables and various library files)

12. Execute the command make install installation. (make install is to copy these compiled executables and library files to the appropriate place)

13,/usr/local/nginx/sbin/nginx start Nginx service.

14, Linux desktop Open Browser input 127.0.0.1 test success.

Nginx Configuration actions:

Nginx set up auto start and chkconfig management.

1. Create nginx files under the/etc/init.d/directory of Linux system.

Add the following command to the script: (You can go to the Nginx website to copy and paste https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/)

2. You need to modify the following two configurations according to your Nginx installation path:

nginx= "/usr/sbin/nginx" to modify the path of the Nginx execution program.

Modify to Nginx = "/usr/local/nginx/sbin/nginx"

Nginx_conf_file= "/etc/nginx/nginx.conf" is modified to the path of the configuration file.

Modified into nginx_conf_file= "/usr/local/nginx/conf/nginx.conf"

3, set the/etc/init.d/nginx File execution permissions: (according to the actual situation to give execution rights)

4,/etc/init.d/nginx can perform nginx stop, start, restart command.

5, the above method completed the use of script to manage nginx services, but can not realize the automatic startup of Nginx boot problem. Add Nginx service to Chkconfig management list first:

Nginx configuration to access the directory via web page specified

1. Create a directory There are some test files

2. vim/usr/local/nginx/conf/nginx.conf Editing configuration file

3. Reload the configuration.

4, display the directory of the specified system/data/www/file

nginx.conf configuration file Options Description:

Linux installation configuration 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.