Nginx Compilation and Configuration

Source: Internet
Author: User
1 Pre-installation of Nginx preparation work

Yum install–y gcc gcc-c++

Yum Install zlib Zlib-devel

Yum Install OpenSSL

2. Compiling and installing Pcre
Execute the following command:

#cd/data/software/pcre-8.32

#./configure–prefix

#make

#make Install

2. Compiling and installing Nginx
Execute the following command:
# cd/data/software/nginx-1.7.0
#./configure--prefix=/data/nginx/--with-http_ssl_module--with-http_spdy_module \
--with-http_stub_status_module--with-pcre

#Make

#Make Install


–with-http_stub_status_module: Support nginx status Query
–with-http_ssl_module: Support HTTPS
–with-http_spdy_module: Support Google's spdy, want to know please Baidu Spdy, this must have SSL support
–with-pcre: In order to support the rewrite rewrite function, it is necessary to develop pcre

Installation Complete Start Nginx.

[Root@localhost Conf]#/data/nginx/sbin/nginx (startup Nginx prompts the following error)

/data/nginx/sbin/nginx:error while loadingshared Libraries:libpcre.so.1:cannot Open shared object file:no such file or Directory

Establishing a soft connection

[Hadoop@sclabhadoop01 ~]$ ln-s/usr/local/lib/libpcre.so.1/lib64/

Determine if the Nginx configuration is the correct command as follows:

/usr/nginx/sbin/nginx–t

/data/nginx/sbin/nginx ( start service )

/data/nginx/sbin/nginx-s Stop ( stop service )

/data/nginx/sbin/nginx-s Reload ( restart service )

Configuration Nginx

#server {
# listening on Port
Listen 80;
# define access using www.xx.com
server_name www.xx.com;

# Setting the Access log for this virtual host
Access_log Logs/www.xx.com.access.log Main;

# Default Request
Location/{
Root/root; # Define the default Web site root location for the server
Index index.phpindex.html index.htm; # Define the name of the index file on the home page

Cases

server {

Listen 80;

server_name bo.artronekp.net;

location/{

root/data/software/beian/;

Index index.html help.html;

}

}

The above describes the Nginx compilation and configuration, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

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