Centos6编译安装Nginx服务
2018-01-06 18:20
246 查看
【1】查看当前系统环境
【2】安装Nginx所需要的pcre库,来支持Nginx具备URI重写功能的rewrite模块
注意 devel的软件包必须要安装
【3】安装openssl-devel来使Nginx提供HTTPS服务
【4】安装Nginx
【5】启动并检查安装结果
【6】Nginx启动与关闭
目录截图
[root@www ~]# cat /etc/redhat-release CentOS release 6.3 (Final) [root@www ~]# uname -r 2.6.32-279.el6.x86_64 [root@www ~]# uname -m x86_64
【2】安装Nginx所需要的pcre库,来支持Nginx具备URI重写功能的rewrite模块
注意 devel的软件包必须要安装
//采用yum安装方式来安装pcre [root@www ~]# yum install pcre pcre-devel -y //查看安装后结果 [root@www ~]# rpm -qa pcre pcre-devel pcre-7.8-7.el6.x86_64 pcre-devel-7.8-7.el6.x86_64 //检查Nginx基础依赖包pcre-devel openssl-devel [root@www ~]# rpm -qa pcre-devel pcre pcre-7.8-7.el6.x86_64 pcre-devel-7.8-7.el6.x86_64
【3】安装openssl-devel来使Nginx提供HTTPS服务
[root@www ~]# yum install openssl openssl-devel -y //安装后检查一下 [root@www ~]# rpm -qa openssl openssl-devel openssl-1.0.1e-57.el6.x86_64 openssl-devel-1.0.1e-57.el6.x86_64
【4】安装Nginx
//创建一个工具目录来存放软件 [root@www tack]# mkdir -p /home/tack/tools //下载安装包(或者http://nginx.org/download/) [root@www tool]# wget -q http://nginx.org/download/nginx-1.6.3.tar.gz [root@www tool]# ls -l nginx-1.6.3.tar.gz -rw-r--r-- 1 root root 805253 4月 8 2015 nginx-1.6.3.tar.gz //**注意** 对于useradd命令 //-M:不创建家目录 //-s:指定用户登陆时使用的shell,nologin就是登陆不了 [root@www tool]# useradd nginx -s /sbin/nologin -M //**注意**对于tar命令 //-v 显示压缩或解压的过程 //-x 解开压缩文件 //-f 目标文件名 //这里就不显示过程 直接解压就好 [root@www tool]# tar xf nginx-1.6.3.tar.gz //**注意**对于编译Nginx软件时候 //--user 设置进程用户权限 //--group 设置进程用户组权限 // --with-http_stub_status_module 激活状态信息 //--with-http_ssl_module 激活ssl功能 [root@www nginx-1.6.3]# ./configure --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module [root@www nginx-1.6.3]# make && make install //**注意**建立软连接方便访问,也方便升级。如果以后要升级就更换该链接 [root@www tool]# ln -s /application/nginx-1.6.3 /application/nginx
【5】启动并检查安装结果
//启动前检查配置文件语法 [root@www application]# /application/nginx/sbin/nginx -t nginx: the configuration file /application/nginx-1.6.3//conf/nginx.conf syntax is ok nginx: configuration file /application/nginx-1.6.3//conf/nginx.conf test is successful //启动Nginx服务 [root@www ~]# /application/nginx/sbin/nginx //查看Nginx服务对应的端口是否成功 [root@www ~]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 5775 root 6u IPv4 34757 0t0 TCP *:http (LISTEN) nginx 5776 nginx 6u IPv4 34757 0t0 TCP *:http (LISTEN)
【6】Nginx启动与关闭
//启动: [root@www ~]# /application/nginx/sbin/nginx //停止/重新加载: [root@www ~]# /application/nginx/sbin/nginx -s stop(quit、reload) //验证配置文件是否合法: [root@www ~]# /application/nginx/sbin/nginx -t //命令帮助: [root@www ~]# /application/nginx/sbin/nginx -h
目录截图
相关文章推荐
- Centos6 编译安装ffmpeg & mplayer
- Centos6编译安装Mysql5.7.18, rpm 安装mysql5.7.18,ubuntu apt安装mysql
- 在CentOS6上编译安装http2.4
- 在centos6,7 上编译安装内核
- Centos6编译安装最新版ffmpeg
- centos6 ansible_playbook编译安装zabbix客户端
- CentOS6编译内核安装Xen4.4或Xen4.2
- [乐意黎转载]CentOS6编译安装PHP7+Nginx
- CentOS6 编译安装Mysql5.6.26
- 在CentOS6 x86_64上编译安装gcc6.3.0
- 在CentOS6上编译安装http2.4
- Centos6、7/Linux 下编译安装 PHP 5.6(升级版本)
- Centos6和Centos7上安装LAMP(PHP-FPM模式、编译安装)
- CentOS6编译安装LAMP:编译安装 PHP5
- CentOS6下Xen 4.1的安装(编译linux3.0内核)
- 在centos6编译安装httpd-2.4
- Centos6编译安装LAMP(FPM模块方式)加速的WordPress应用
- CENTOS6下MYSQL5.519源码编译安装
- CentOS6基于源码编译安装LAMP实现WordPress功能和xcache功能
- Centos6-7安装Python3.5以及SSL的编译安装,识别https