Keep writing a blog post every day 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0003.gif "alt=" J_0003.gif "/> Today began to write the simple installation of nginx, tomorrow continue to explain the configuration files and some parameters, only for reference!
First, prepare a virtual machine:
ip:192.168.1.214
Turn off the firewall and set SELinux to Disabled
[[email protected] ~]service iptables stop[[email protected] ~]chkconfig iptables off[[email protected] ~]sed-i ' S#selinu X=enforcing#selinux=disabled#g '/etc/selinux/config
Second, before installing Nginx, first make sure to install the Gcc,openssl-devel,pcre-devel,zilb-devel Software Library.
install pcre is to make Nginx support HTTP rewrite module, installation is also very simple, the process is as follows:
Download official website: [[email protected] ~] #yum install-y Pcre-devel[[email protected] ~] #tar zxvf nginx-1.2.9.tar.gz [[email protected] ~] #cd nginx-1.2.9[[email protected] ~]#./configure--with-http_stub_status_module \ #启用nginx的nginxstauts功能, To monitor the current status of Nginx--prefix=/application/nginx \ #Nginx的安装路径--with-http_gzip_static_module #启用HttpGzip模块make && Make install# So, Pcre is installed!
Hint: In fact, nginx installation is also very simple, by default, after the installation of Nginx has been compiled with a lot of modules can be used.
We can use "./configure--help" To view the usage of each module.
Example: Do not install the Http_ssi module
Execution:--without-http_ssi_module
Third, the installation process of Nginx is as follows:
[[email protected] ~]# tar zxvf nginx-1.6.0.tar.gz [[email Protected] ~]# cd nginx-1.6.0 [[email protected] ~]# ./configure --prefix=/usr/local --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/ nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/ log/nginx/access.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/ nginx.lock --user=nginx \ --group=nginx --with-http_ssl_module -- With-http_flv_module --with-http_stub_status_module \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/tmp/nginx/client/ \ --http-proxy-temp-path=/var /tmp/nginx/proxy/ \ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ -- Http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \&nbSp; --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre[[email protected] ~]# make && make install# start nginx[[email protected] ~]#/usr/sbin/nginx# to see if the port is started [email protected] ~]# netstat -lntup|grep nginxtcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1072/nginx
After the Nginx installation is complete, enter the ip:192.168.1.214 in the browser
An Nginx welcome interface appears, indicating that it has been successful! 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0003.gif "alt=" J_0003.gif "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5E/21/wKioL1UpP7rDwhfcAAHASuksSEc848.jpg "title=" 36020150411233007907.jpg "alt=" Wkiol1upp7rdwhfcaahasukssec848.jpg "/>
Nginx also has some common commands:
#检查语法/usr/sbin/nginx–t# Smooth Restart/usr/sbin/nginx–sreload# Uninterrupted service restart, reset the PID stroke (restart) kill–hup ' cat/opt/nginx/logs/ Nginx.pid ' #关闭Kill process number
Iv. adding a compilation module
After installing Nginx, what should we do if we need to add a module that is not compiled and installed now?
Nginx-v ==> can see which parameters were added with the original compilation:--with-http_stub_status_module--with-http_ssl_module--with-http_realip_ The module steps are as follows: 1. Reconfigure with parameters:./configure--user=nginx--group=nginx--prefix=/application/nginx1.6.2--with-http_stub_status_module-- With-http_gzip_static_module--with-http_ssl_module--add-module=. /nginx_upstream_hash-0.3.1/--add-module=. /GNOSEK-NGINX-UPSTREAM-FAIR-2131C73/2. Compiling: Make
Note: Do not install or overwrite the installation
also available through the official View module installation Example http://nginx.org/en/docs/
This article is from the "Liang Enyu-9527" blog, be sure to keep this source http://liangey.blog.51cto.com/9097868/1631399
Installation of Nginx high Performance Web server (ii)