服务器 CentOS上yum安装Nginx服务
一、更改yum源为网易的源加快速度
vi /etc/yum.repos.d/CentOS-Base.repo
更改内容如下
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
二、update yum
yum -y update
三、利用CentOS Linux系统自带的yum命令安装、升级所需的程序库
LANG=C
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng
libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib
zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses
ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel
libidn libidn-devel openssl openssl-devel openldap openldap-devel
nss_ldap openldap-clients openldap-servers
四、安装php和mysql
yum -y install php mysql mysql-server mysql-devel php-mysql php-cgi php-mbstring php-gd php-fastcgi
五、安装nginx
由于centos没有默认的nginx软件包,需要启用REHL的附件包
rpm -Uvh http://download.Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum -y install nginx
设置开机启动
chkconfig nginx on
六、安装spawn-fcgi来运行php-cgi
yum install spawn-fcgi
七、下载spawn-fcgi 的启动脚本
wget http://bash.cyberciti.biz/dl/419.sh.zip
unzip 419.sh.zip
mv 419.sh /etc/init.d/php_cgi
chmod +x /etc/init.d/php_cgi
启动php_cgi
/etc/init.d/php_cgi start
查看进程
netstat -tulpn | grep :9000
若出现如下代表一切正常
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 4352/php-cgi
八、配置nginx(详细配置见nginx.conf详细说明)
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
九、查看phpinfo
编写脚本
phpinfo();
十、安装phpmyadmin
修改/var/lib/php/session的权限和nginx和php_cgi一致
chown -R www.www /var/lib/php/session
详情:http://www.myhack58.com/Article/sort099/sort0102/2011/29472.htm或者http://ninghao.net/blog/1368或者http://blog.sina.com.cn/s/blog_5fd841bf0101mwfz.html或者http://jingyan.baidu.com/article/5d368d1eed38ac3f60c05791.html?qq-pf-to=pcqq.c2c
服务器 CentOS上yum安装Nginx服务的更多相关文章
- CentOS上yum安装Nginx服务
一.更改yum源为网易的源加快速度 vi /etc/yum.repos.d/CentOS-Base.repo更改内容如下 # CentOS-Base.repo # # This file uses a ...
- centos 下yum 安装nginx
centos 下yum 安装nginx 1. 直接yum install nginx不行,要先处理下源: rpm -ivh http://nginx.org/packages/centos/6/noa ...
- Centos下yum安装Nginx报错 No package nginx available.
在Centos6下使用yum安装Nginx报错 解决方案: yum install epel-release
- centos直接yum安装nginx
Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便. 但是今天装了CentOS6.2,直接yum install nginx不行,要先处理下源,下面是安装完整流 ...
- 转载:centos上yum安装apache+php+mysql等
1. 更新系统内核到最新. [root@linuxfei ~]#yum -y update 系统更新后,如果yum安装时提示错误信息,请执行以下命令修复. [root@linuxfei ~]#rpm ...
- Linux的CentOS上如何安装nginx
1. 安装nginx前,首先要装好gcc和g++环境: 2. 在centOS上装nginx,需要PCRE.zlib和ssl的支持,出ssl外其他都需要从其官网上下载好,上传至服务器: 3. 接着将上传 ...
- centos 下 yum 安装 nginx 平滑切换安装到 Tengine
---恢复内容开始--- 据说淘宝的Tengine很牛X,所以我们今天也来玩玩,我们这里是某开放云的vps,现在已经安装好了nginx,现在我们要平滑切换到安装Tengine. 下载Tengine,解 ...
- CentOS 7 yum 安装 Nginx
1.添加Nginx到YUM源 添加CentOS 7 Nginx yum资源库,打开终端,使用以下命令: sudo rpm -Uvh http://nginx.org/packages/centos/7 ...
- centos上yum安装异常处理
最近在centos上通过yum来安装程序,出下了以下问题: Loaded plugins: fastestmirror Setting up Install Process Loading mirro ...
随机推荐
- iframe框架里镶嵌页面;<marquee>:滚动效果;<mark>做标记;内联、内嵌、外联;选择器
标签:①②③④⑤⑥⑦★ 框架: 一.frameset:(框架集) 1.如果使用框架集,当前页面不能有body 2.cols="300,*":左右拆分,左边宽300,右边宽剩余 3. ...
- jquery mobile 方法收集.
1.在列表项和按钮上禁用文本截断 如果你的列表项或者按钮上是一个很长的文本,它将会被jQuery Mobile自动截断,要禁用这个截断设置,需要在CSS选择器上添加属性"white- ...
- TCP的三次握手四次挥手
一.三次握手 1.wireshark 抓包 2.TCP报文手部 注意标志位: 1).同步 SYN = 1 表示这是一个连接请求或连接接受报文. 2).只有当 ACK = 1 时确认号字段才有效.当 A ...
- zepto源码--compact、flatten、camelize、dasherize、uniq--学习笔记
1.compact 删除数组中的空元素(不是空字符串).undefined.null 在定义变量时,定义过filter = emptyArray.filter,即调用javascript原生的数组处理 ...
- Fiddler-005-获取 Cookie 信息
随着网络安全(例如:登录安全等)要求的不断提升,越来越多的登录应用在登录时添加了验证码登录,而验证码生成算法也在不断的进化,因而对含登录态的自动化测试脚本运行造成了一定程度的困扰,目前解决此种问题的方 ...
- JS-007-富文本域操作
在日常 web 编写过程中,富文本域几乎成为了一个网站不可页面元素,同时,其也有着各种各样的实现方式,网络上也存在着各种各样的集成插件可供引用.此文以 js 获取.修改 163 邮箱写邮件时的邮件内容 ...
- 目标检测的图像特征提取之(一)HOG特征
http://blog.csdn.net/liulina603/article/details/8291093
- shell脚本编程-处理用户输入
命令行参数 命令行参数:允许在运行脚本时向命令行添加数据值 如:$ ./addem 10 30 读取参数 bash shell会将一些称为位置参数的特殊变量分配给命令行输入的所有参数,甚至包括shel ...
- nginx源码学习----内存池
最近在进行监控平台的设计,之前一直觉得C/C++中最棘手的部分是内存的管理上,远不止new/delete.malloc/free这么简单.随着代码量的递增,程序结构复杂度的提高.各种内存方面的问题悄然 ...
- 获取启动画面图片的string
支持 iPhone 以下. 支持 iPhone 及 iPad +(NSString*)getLaunchImageName { NSArray* images= @[@"LaunchImag ...