Home > php教程 > php手册 > body text

Centos Nginx+php+mysql 配置

WBOY
Release: 2016-06-06 20:07:33
Original
1390 people have browsed it

今天买了一台Linux 的VPS,想用它做蓝图影评网的服务器。讲讲它的一些配置吧。 因为我们在中国, 1.所以要添加安装源 cd /etc/yum.repos.d/ /etc/yum.repos.d/centos.21andy.com.repo 添加收下内容 [CentALT] name=21Andy.com Packages for Enterprise Linux

  今天买了一台Linux 的VPS,想用它做蓝图影评网的服务器。讲讲它的一些配置吧。

   因为我们在中国,

   1.所以要添加安装源

   cd /etc/yum.repos.d/ 

   /etc/yum.repos.d/centos.21andy.com.repo

   添加收下内容 

  [CentALT] 

  name=21Andy.com Packages for Enterprise Linux 5 - $basearch
baseurl=http://www.21andy.com/centos/5/$basearch/

  enabled=1 

  gpgcheck=0

  protect=1 

记得一定要更新

rpm -Uvh http://centos.alt.ru/repository/centos/5/i386/centalt-release-5-3.noarch.rpm
rpm -Uvh http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

yum -y update

  2.完整安装php mysql nginx

  yum -y install nginx mysql mysql-server php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator

    这里要注意一点,在安装mysql的时候,它不会像在win安装的时候提醒你输入账号密码,它会先默认一个账号root 密码未空,所以等等要重新设计mysql的账号密码。

  三、启动服务

   service mysqld start

   service php-fpm start

   service nginx start

  chkconfig --level 345 mysqld on   //设置开机启动

  chkconfig --level 345 php-fpm on  //设置开机启动 

   chkconfig --level 345 nginx on   //设置开机启动

   下面要对mysql进行配置

   1.mysql -u root   //使用root账号进行登录

   2.select user,host,password from mysql.user;  ///查看用户信息

   3.set password for root@localhost=password('在这里填入root密码')  //设置密码

   4. exit;

   5.mysql -u root -p

   6.输入密码

   7.成功设置密码

   在MySQL刚刚被安装后,存在用户名、密码为空的用户。这使得数据库服务器有无需密码被登录的可能性。为消除隐患,将匿名用户删除。

  8.delete from mysql.user where user='';

   9.select user,password,localhost from mysql.user;

   到这里mysql算是配置完成!

   等等讲配置nginx

  记得还要开启80端口 怎么开启80端口看 http://www.phpyu.com/?post=61

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!