安装Tengine
建站服务器 1.安装VMware
创新互联建站服务项目包括延庆网站建设、延庆网站制作、延庆网页制作以及延庆网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,延庆网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到延庆省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!2.安装CentOS6.53.配置网络a.修改/etc/sysconfig/network-scripts/ifcfg-eth0配置文件,添加如下内容 DEVICE=eth0 HWADDR=00:0C:29:96:01:6B TYPE=Ethernet UUID=41cbd943-024b-4341-ac7a-e4d2142b4938 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none IPADDR=xxx.xxx.x.xxx #例如:IPADDR=192.168.2.140 NETMASK=255.255.255.0 GATEWAY=192.168.2.2 b.修改/etc/resolv.conf配置文件,添加如下内容 nameserver192.168.2.2 c.servicenetworkrestart d.ifconfig e.pingwww.baidu.com 如果能拼通表示可以连接外部网络4.修改yum源为Aliyun yum源
a.备份原有的源 mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup b.下载新的CentOS-Base.repo到/etc/yum.repos.d/这个目录下 CentOS5 wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-5.repo 或者 curl-o/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-5.repo CentOS6 wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-6.repo 或者 curl-o/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-6.repo CentOS7 wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo 或者 curl-o/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo c.运行yummakecache命令生成缓存5.安装编译环境
yum-yinstallgccopenssl-develpcre-develzlib-devel6.安装Tengine
a.下载或上传tengine-2.1.0.tar.gz到/opt下 ls/opt cd/opt b.解压 tar-zxvftengine-2.1.1.tar.gz ls cdtengine-2.1.0 ls c.检查依赖 ./configure\\ --prefix=/opt/sxt/soft/tengine-2.1.0/\\ --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\\ --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\\ --http-scgi-temp-path=/var/tmp/nginx/scgi\\ --with-pcre d.编译并安装 make&&makeinstall7.安装添加到启动文件
a.在/etc/init.d下面建立nginx文件,内容如下 #!/bin/bash # #chkconfig:-8515 #description:nginxisaWorldWideWebserver.Itisusedtoserve #Sourcefunctionlibrary. ./etc/rc.d/init.d/functions #Sourcenetworkingconfiguration. ./etc/sysconfig/network #Checkthatnetworkingisup. ["$NETWORKING"="no"]&&exit0 nginx="/usr/tengine-2.1/sbin/nginx" prog=$(basename$nginx) NGINX_CONF_FILE="/usr/tengine-2.1/conf/nginx.conf" #[-f/etc/sysconfig/nginx]&&./etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx #make_dirs(){ ##makerequireddirectories #user=`nginx-V2>&1|grep"configurearguments:"|sed's/[^*]*--user=\\([^]*\\).*/\\1/g'-` #options=`$nginx-V2>&1|grep'configurearguments:'` #foroptin$options;do #if[`echo$opt|grep'.*-temp-path'`];then #value=`echo$opt|cut-d"="-f2` #if[!-d"$value"];then ##echo"creating"$value #mkdir-p$value&&chown-R$user$value #fi #fi #done #} start(){ [-x$nginx]||exit5 [-f$NGINX_CONF_FILE]||exit6 #make_dirs echo-n$"Starting$prog:" daemon$nginx-c$NGINX_CONF_FILE retval=$? echo [$retval-eq0]&&touch$lockfile return$retval } stop(){ echo-n$"Stopping$prog:" killproc$prog-QUIT retval=$? echo [$retval-eq0]&&rm-f$lockfile return$retval } restart(){ configtest||return$? stop sleep1 start } reload(){ configtest||return$? echo-n$"Reloading$prog:" #-HUP是nginx平滑重启参数 killproc$nginx-HUP RETVAL=$? echo } force_reload(){ restart } configtest(){ $nginx-t-c$NGINX_CONF_FILE } rh_status(){ status$prog } rh_status_q(){ rh_status>/dev/null2>&1 } case"$1"in start) rh_status_q&&exit0 $1 ;; stop) rh_status_q||exit0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q||exit7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q||exit0 ;; *) echo$"Usage:$0{start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit2 esac b.修改nginx配置文件 将nginx="/usr/tengine-2.1/sbin/nginx"修改为nginx="/opt/sxt/soft/tengine-2.1.0/sbin/nginx" 将NGINX_CONF_FILE="/usr/tengine-2.1/conf/nginx.conf"修改为NGINX_CONF_FILE="/opt/sxt/soft/tengine-2.1.0/conf/nginx.conf" 保存退出:wq c.给nginx添加执行权限 chmod755nginx d.启动服务 servicenginxstart e.在d步时会报错,需要手动创建/var/tmp/nginx/client/这个目录 mkdir-p/var/tmp/nginx/client/ servicenginxstart f.关闭防火墙 serviceiptablesstop8.在浏览器中访问tengine
http://192.168.2.140/
网站标题:安装Tengine
路径分享:http://pwwzsj.com/article/cjegio.html