Today's nginx is more and more fierce, remember the 2011 version is only 1.0 6, has now been updated to 1.5.1,nginx update faster and faster. Have always wanted to record a series of nginx tutorials, for a variety of reasons not to do. Take the time to finish the nginx that you normally use in your work this year. The following will be done in a video tutorial. Of course, the article first out, the next article will talk about Nginx virtual host configuration. Have any suggestion, hope everybody leave a message.
1, necessary software preparation
• Install Pcre
In order to support the rewrite function, we need to install Pcre
View Sourceprint?
# yum Install pcre*/If you've already installed, please skip this step
• Install OpenSSL
Requires SSL support, skip this step if SSL support is not required
Copy Code code as follows:
2. Installation Nginx
Execute the following command:
Copy Code code as follows:
#./configure--prefix=/usr/local/nginx-1.5.1 \
--with-http_ssl_module--with-http_spdy_module \
--with-http_stub_status_module--with-pcre
–with-http_stub_status_module: Support nginx status Query
–with-http_ssl_module: Support HTTPS
–with-http_spdy_module: Support the spdy of Google, want to understand please Baidu Spdy, this must have the support of SSL
–with-pcre: In order to support the rewrite rewrite function, it is necessary to develop pcre
The final output of the following content, said configure OK.
...
Copy Code code as follows:
Checking for zlib library ... found
Creating Objs/makefile
Configuration Summary
+ Using System PCRE Library
+ Using System OpenSSL Library
+ md5:using OpenSSL Library
+ sha1:using OpenSSL Library
+ Using System zlib Library
Nginx path prefix: "/usr/local/nginx-1.5.1"
Nginx binary file: "/usr/local/nginx-1.5.1/sbin/nginx"
Nginx configuration prefix: "/usr/local/nginx-1.5.1/conf"
Nginx configuration file: "/usr/local/nginx-1.5.1/conf/nginx.conf"
Nginx pid file: "/usr/local/nginx-1.5.1/logs/nginx.pid"
Nginx error log file: "/usr/local/nginx-1.5.1/logs/error.log"
Nginx HTTP access log file: "/usr/local/nginx-1.5.1/logs/access.log"
Nginx HTTP client request body Temporary files: "Client_body_temp"
Nginx HTTP proxy temporary files: "Proxy_temp"
Nginx http fastcgi temporary files: "Fastcgi_temp"
Nginx http Uwsgi temporary files: "Uwsgi_temp"
Nginx http scgi temporary files: "Scgi_temp"
# Make/Confirm your server has install make, if not installed please perform yum install
# make Install
3, start, close, reset Nginx
Start: Direct execution of the following command, Nginx started, do not need to change any configuration files, Nginx Configure multiple domain name Virtual host please refer to the following articles.
Copy Code code as follows:
/usr/local/nginx-1.5.1/sbin/nginx
Try the visit: I do not map, directly using the Curl command to read web information
Copy Code code as follows:
[Root@ns conf]# curl-s http://localhost | grep nginx.com
Nginx.com.
Shut down:
Copy Code code as follows:
/usr/local/nginx-1.5.1/sbin/nginx-s stop
Reset: When you have modified the configuration file, you only need to reload the following
Copy Code code as follows:
/usr/local/nginx-1.5.1/sbin/nginx-s Reload
The entire Nginx installation is over here.