LNMP搭建2:Nginx编译安装
2017-02-24 22:39
507 查看
1.切换到/usr/local/src/目录下载nginx-1.6.2.tar.gz安装包
[root@centos6 ~]# cd /usr/local/src
[root@centos6 src]# ls
nginx-1.6.2.tar.gz
2.解压安装包
[root@centos6 src]# tar zxvf nginx-1.6.2.tar.gz
[root@centos6 src]# echo $?
0
3.进入安装目录
[root@centos6 src]# cd nginx-1.6.2
安装配置依赖项
[root@centos6 src]# yum install -y gcc pcre-devel zlib-devel
配置安装选项
[root@centos6 nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --with-pcre
4.直到配置全部正确开始编译
[root@centos6 nginx-1.6.2]# echo $?
0
[root@centos6 nginx-1.6.2]# make
5.编译无误之后开始安装
[root@centos6 nginx-1.6.2]# echo $?
0
[root@centos6 nginx-1.6.2]# make install
[root@centos6 nginx-1.6.2]# echo $?
0
6.安装好之后可以看到如下目录结构,其中nginx是可执行文件,类似于httpd
[root@centos6 nginx-1.6.2]# ls /usr/local/nginx/
conf html logs sbin
[root@centos6 nginx-1.6.2]# ls /usr/local/nginx/sbin
nginx
7.将nginx加入系统环境变量PATH中:
[root@centos6 nginx-1.6.2]# vim /etc/profile.d/path.sh
#!/bin/bash
export PATH=$PATH:/etc/init.d/:/usr/local/mysql/bin/:/usr/local/php/bin/:/usr/local/php/php/sbin/:/usr/local/nginx/sbin/
[root@centos6 nginx-1.6.2]# source /etc/profile.d/path.sh
8.启动Nginx服务
[root@centos6 nginx-1.6.2]# nginx
9.查看Nginx进程
[root@centos6 nginx-1.6.2]# ps aux | grep nginx
root 1870 0.0 0.0 3548 520 ? Ss 06:48 0:00 nginx: master process nginx
nobody 1871 0.0 0.0 3732 876 ? S 06:48 0:00 nginx: worker process
root 1873 0.0 0.0 5984 748 pts/0 S+ 06:48 0:00 grep nginx
10.查看端口
[root@centos6 nginx-1.6.2]# netstat -lnp |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 12001/nginx
[root@centos6 ~]# cd /usr/local/src
[root@centos6 src]# ls
nginx-1.6.2.tar.gz
2.解压安装包
[root@centos6 src]# tar zxvf nginx-1.6.2.tar.gz
[root@centos6 src]# echo $?
0
3.进入安装目录
[root@centos6 src]# cd nginx-1.6.2
安装配置依赖项
[root@centos6 src]# yum install -y gcc pcre-devel zlib-devel
配置安装选项
[root@centos6 nginx-1.6.2]# ./configure --prefix=/usr/local/nginx --with-pcre
4.直到配置全部正确开始编译
[root@centos6 nginx-1.6.2]# echo $?
0
[root@centos6 nginx-1.6.2]# make
5.编译无误之后开始安装
[root@centos6 nginx-1.6.2]# echo $?
0
[root@centos6 nginx-1.6.2]# make install
[root@centos6 nginx-1.6.2]# echo $?
0
6.安装好之后可以看到如下目录结构,其中nginx是可执行文件,类似于httpd
[root@centos6 nginx-1.6.2]# ls /usr/local/nginx/
conf html logs sbin
[root@centos6 nginx-1.6.2]# ls /usr/local/nginx/sbin
nginx
7.将nginx加入系统环境变量PATH中:
[root@centos6 nginx-1.6.2]# vim /etc/profile.d/path.sh
#!/bin/bash
export PATH=$PATH:/etc/init.d/:/usr/local/mysql/bin/:/usr/local/php/bin/:/usr/local/php/php/sbin/:/usr/local/nginx/sbin/
[root@centos6 nginx-1.6.2]# source /etc/profile.d/path.sh
8.启动Nginx服务
[root@centos6 nginx-1.6.2]# nginx
9.查看Nginx进程
[root@centos6 nginx-1.6.2]# ps aux | grep nginx
root 1870 0.0 0.0 3548 520 ? Ss 06:48 0:00 nginx: master process nginx
nobody 1871 0.0 0.0 3732 876 ? S 06:48 0:00 nginx: worker process
root 1873 0.0 0.0 5984 748 pts/0 S+ 06:48 0:00 grep nginx
10.查看端口
[root@centos6 nginx-1.6.2]# netstat -lnp |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 12001/nginx
相关文章推荐
- Nginx实战基础篇六 通过源码包编译安装部署LNMP搭建Discuz论坛 推荐
- CentOS 7源码编译安装PHP5.6和Nginx1.7.9及MySQL(搭建LNMP环境)
- CentOS 6.5 LNMP环境搭建 编译安装Nginx
- 源码编译安装,搭建LNMP环境(Linux+Nginx+MySQL+PHP)
- 基于CentOS 6.8平台最新源代码包编译安装LNMP环境搭建(Nginx+MySQL+PHP)
- centos7搭建lnmp编译安装nginx【二】
- LNMP一键安装包-CentOS 5/6下自动编译安装Nginx,MySQL,PHP,memcached
- CentOS-6.4 源码包编译安装LNMP +Discuz开源论坛(mysql-5.6.14 +PHP-5.4.21+nginx-1.4.2)
- Ubuntu 搭建LNMP环境图文教程 安装Nginx服务器
- CentOS 5.6(X64)下编译安装LNMP平台(Nginx1.0.4+PHP5.3.6+Mysql5.5.12)
- 编译安装LNMP红帽6.4(64位)Nginx1.4.1+mysql5.6.+php5.4.4
- CentOS6.x编译安装LNMP(Linux+Nginx+Mysql+PHP)
- CentOS 6.3 编译安装搭建LNMP
- CentOS 5.6(X64)下编译安装LNMP平台(Nginx1.0+PHP5.3.6+Mysql5.5.11)
- lnmp(nginx1.4.5+mysql5.5+php5.4)编译版搭建论坛
- 生产环境Centos LNMP编译安装nginx-1.6 MySQL-5.6 php-5.5
- 编译安装LNMP环境,搭建wordpress博客
- CentOS 5.5安装Nginx、PHP(FastCGI)、MySQL --搭建LNMP环境安装Wordpress、Discuz
- 编译安装LNMP(Redhat5.4+nginx-1.0.13+mysql-5.5.20+php-5.3.6)
- ubuntu12.04 虚拟机 编译安装nginx 1.3.6 搭建支持flv mp4 流媒体服务器