Install Nginx on CentOS 7

Source: Internet
Author: User

Install Nginx on CentOS 7

Notes for installing Nginx in CentOS 7: learn a little bit about nginx during this time due to learning needs ". We will not discuss nginx any more. http://wiki.nginx.org/mainwill provide a detailed introduction to zookeeper installation.

I am used to downloading the source code from the official website. http://nginx.org/, we can see that nginxis still very popular. Today, it is, and the latest version is already 07-14, mainly including stable and mainline versions.

The stable version I selected for 1.8.0. The software is a little smaller than kb. Download to the host directly on the webpage. You can also download wget at http://nginx.org/download/nginx-1.8.0.tar.gz

tar -xf nginx-1.8.0.tar.gz

Use tar unzip, unzip after, enter the directory can install according to the instructions of the official website (http://wiki.nginx.org/Install)

I also manually paste the text version operation steps. If you are too lazy to do so, press ctrl + C:

./configure

make

sudo make install

./Configure can be configured. For details, refer to (if you have no pressure on the English manual, you can directly configure -- help for help ):

  • --prefix=PATH: Specifies the installation directory of nginx. Default/usr/local/nginx
  • --conf-path=PATH: Set the path of the nginx. conf configuration file. Nginx can be started using different configuration files through the-c option in the command line. Default Value:Prefix/conf/nginx. conf
  • --user=name: Set the nginx worker process. After installation, you can change the user command in the nginx. conf configuration file at any time. The default user name is nobody.--group=nameSimilar
  • --with-pcre: Set the source code path of the PCRE Library. If the file has been installed in yum mode, use--with-pcreAutomatically find the library file. Use--with-pcre=PATHDownload the source code of the PCRE Library from the pcre website (version 4.4-8.30) and decompress the package../configureAndmake. Perl regular expressions are used inlocationCommands andngx_http_rewrite_moduleModule.
  • --with-zlib=PATH: Decompress the source code directory of zlib (Version 1.1.3-1.2.5. The network transmission compression module is enabled by default.ngx_http_gzip_moduleZlib is required.
  • --with-http_ssl_module: Use the https protocol module. By default, this module is not built. The premise is that openssl and openssl-devel have been installed.
  • --with-http_stub_status_module: Used to monitor the current status of Nginx
  • --with-http_realip_module: This module allows us to change the Client IP address value (For example, X-Real-IP or X-Forwarded-For) in the client request header. This module enables the background server to record the IP address of the original client.
  • --add-module=PATH: Add third-party external modules, such as nginx-sticky-module-ng or cache module. Re-compile every time a new module is added (Tengine does not need to be re-compiled when a new module is added)

Nginx installation is complete. Some minor errors may occur in some earlier versions of linux, but there is nothing to roll back. You may need to install openssl, pure, and CentOS7, the installation is also simple. After the installation is complete, there are four more directories under the directory you specified. We will start nginx in sbin:

The "Permission denied" error occurs, which is obviously a Permission issue. If you are familiar with Linux, you will not be surprised because Linux has strict permissions. In the figure, port 80 is used for bind, linux requires the root permission to use the port lower than 1024. The solution is also very simple. Find the configuration file nginx below. replace the port with conf (you should know another method when you are using Linux programming. First, chown nginx is the root, and then click SET-USER-ID on it, the following two commands are used: chown and chmod. For more information, see my blog: http://www.cnblogs.com/ittinybird/p/4466171.html ).

Use nginx-s reload to reload the configuration file. A welcome page is displayed when you access the browser.

The entire process is very simple, enjoy!

For more Nginx tutorials, see the following:

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx log filtering using ngx_log_if does not record specific logs

Nginx details: click here
Nginx: click here

This article permanently updates the link address:

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.