1.查看当前系统版本。
#cat /etc/redhat-release
2.关闭SElinux 查看启动状态: #getenforce (1.enforcing 为开启状态 (2.Disadnled 为关闭状态 临时关闭SELinux: setenforce 0 永久关闭SElinux: vim /etc/selinux/config 光标锁定在SELINUX=enforcing 这一行,编辑修改 SELinux=disabled 保存修改;
3.安装NGINX或者tengine(tengine拥有特殊的安装module选项) (1)添加NGINX运行用户: groupadd -r nginx useradd -r -g nginx nginx (2)下载源码包进行编译安装
wget http://nginx.org/download/nginx-1.10.2.tar.gz
tar xvf nginx-1.10.2.tar.gz -C /usr/local/src
yum groupinstall "Development tools"
yum -y install gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel
cd /usr/local/src/nginx-1.10.2
./configure
--prefix=/usr/local/nginx
--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.pid
--lock-path=/var/run/nginx.lock
--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
--http-scgi-temp-path=/var/tmp/nginx/scgi
--user=nginx
--group=nginx
--with-pcre
--with-http_v2_module
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_stub_status_module
--with-http_auth_request_module
--with-mail
--with-mail_ssl_module
--with-file-aio
--with-ipv6
--with-http_v2_module
--with-threads
--with-stream
--with-stream_ssl_module
make && make install
mkdir -p /var/tmp/nginx/client
(3).添加sysV启动脚本 vim新建文件,或者touch一个new file: vim /etc/init.d/nginx 键入如下内容:
(3).添加sysV启动脚本 vim新建文件,或者touch一个new file: vim /etc/init.d/nginx 键入如下内容: