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.