CentOS 6 builds nginx to provide web services, centosnginx

Source: Internet
Author: User

CentOS 6 builds nginx to provide web services, centosnginx

I hope you can advise me what's wrong with this article.

Databases to be dependent on:

1. the gzip module requires the zlib library (download: http://www.zlib.net /)

2. The rewrite module requires the pcre Library (download: http://www.pcre.org /)

3. ssl features require the openssl library (download: http://www.openssl.org /)

You can use rpm-q xxx to check whether the library has been installed successfully.

You can use yum-y install xxx to install

If prce is not installed, the following error occurs:

The next step is to install nginx. Before installation, create a dedicated user and group to facilitate later permission control.

   

useradd –M –s /sbin/nologin nginx

-M indicates that the user's home directory is not created.-s indicates the shell used after the user logs on. The nologin shell indicates that the user is not allowed to log on to the system.

   

wget http://nginx.org/download/nginx-1.7.8.tar.gz

tar zxvf nginx-1.7.8.tar.gz –C /tmp/

cd /tmp/nginx-1.7.8/

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

Download wget, decompress tar to the/tmp/directory, and execute configure file configuration in the local directory:

Prefix = installation directory

User = and group = Specify the user and user group

-- With-http_stub_status_module activation status statistics

Next, compile and install

   

Make & make install

Ln-s/usr/local/nginx/sbin/nginx/usr/local/sbin/create soft link

Nginx-t to check whether the installation is successful

Successful

   

Cat/usr/local/nginx/logs/nginx. pid // view the process ip Address

Kill-s QUIT 31140 // peaceful exit process

Vi/usr/local/nginx/conf/nginx. conf enter the configuration file

   

Worker_processes 1; // indicates the number of processes.

Events {
Worker_connections 1024; // indicates the number of connections to each process. This value is 1024.
}

   

Server {
Listen 80; // listening port
Server_name www.xxx.com; // Domain Name

Charset UTF-8; // Encoding

# Access_log logs/host. access. log main;

Location /{
Root html; // website root directory Definition
Index index.html index.htm; // default index homepage, which can be defined
}

If you have multiple websites on the same port, you can add the server {} segment. The domain name is different from the website root directory definition.

The next chapter records how to support the php environment.

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.