Today, nginx is becoming increasingly popular. I remember that it was only 1.0.6 in 2011. Now it has been updated to 1.5.1, and nginx is updated faster and faster. I have always wanted to record a series of nginx tutorials for various reasons and have not done them. This year I took the time to complete the nginx I used in my daily work. I will follow the tutorial in the future. Of course, the article goes first, and the next article will talk about nginx virtual host configuration. If you have any suggestions, please leave a message.
1. necessary software preparation
To support rewrite, We need to install PCRE
# Yum install PCRE * // if you have installed it, skip this step. |
SSL support is required. skip this step if SSL support is not required.
2,
Install nginx
Run the following command:
# ./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 for nginx status query
-With-http_ssl_module: Support for HTTPS
-With-http_spdy_module: support Google spdy, would like to know Baidu spdy, this must have SSL support
-With-PCRE: To support rewrite, you must specify a PCRE
The output is as follows, indicating that configure is OK.
.....
checking for zlib library ... found |
+ 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 // make sure that make is installed on your server. If not, execute Yum install make |
3. Start, close, and reset nginx
Start: directly execute the following command to start nginx. You do not need to change any configuration file. For nginx configuration of multi-domain virtual hosts, refer to subsequent articles.
/usr/ local /nginx-1.5.1/sbin/nginx |
Try to access: I don't need to map this site. I directly use the curl command to read Web information.
[[email protected] conf] # curl -s http://localhost | grep nginx.com |
Close:
/usr/ local /nginx-1.5.1/sbin/nginx -s stop |
Reset: When you modify the configuration file, you only need to reload the following
/usr/ local /nginx-1.5.1/sbin/nginx -s reload |
The installation of nginx is now over.
Reprinted please indicate the source: http://www.ttlsa.com/html/1548.html