阿里云centos部署apache+php

WBOY
Release: 2016-06-23 13:50:08
Original
989 people have browsed it

       经过一个下午的尝试,终于完成了阿里云apache+php服务器的搭建,我的数据库用的是阿里云的RDS,不需要在服务器中安装mysql了。在我的服务器中最后部署了phpMyAdmin,测试可以管理RDS上的数据库。服务器的搭建宣布完成。留下了做个记录。下次再部署的话就不用大量的搜索和尝试了。

一、下载Xshell+xftp,安装xftp。

二、Xshell新建连接,服务器的外网IP,用户名:root,密码:连接服务的密码



三、打开刚创建的连接,确保成功连接到服务器


四、因为我没有买数据盘,所以数据盘的挂载略过;

五、安装apache,执行 yum install httpd 安装apache。

        执行:chkconfig --levels 235 httpd on 使apache开机自启动,执行:chkconfig --list 可以查看设置是否成功

六、在浏览器中输入服务器地址访问,如果正常打开页面,说明apache安装成功;

七、安装PHP,执行 yum install php安装;安装完成php后,执行命令安装 yum install php-mysql php-gd php-imap php-mbstring 等php模块,我暂时用这几个。

八、新建一个php文件,index.php。

        内容:

       

<span style="font-family:Microsoft YaHei;font-size:14px;">	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">	<title>my www</title>	<?php phpinfo()	?></span>
Copy after login
        将文件上传到服务器中 /var/www/html/ 目录下。

九、在浏览器中输入服务器地址访问,如果正常打开如下页面,说明php安装成功

十、我买了阿里云RDS数据库,所以没有安装mysql。如果需要安装mysql,执行命令 yum -install mysql-server,自启动设置同apache,具体的配置我没有尝试。

十一、部署phpMyAdmin到服务器上,管理RDS上的远程数据库。

          下载phpMyAdmin,解压后上传到服务的 /var/www/html/ 目录中。

          

           进入phpMyAdmin配置文件目录 /var/www/html/phpMyAdmin/libraries/,

           编辑config.default.php文件(执行:vim config.default.php)

           设置$cfg['Servers'][$i]['host'] = '(RDS内网地址)';(因为服务器是阿里云的,所以可以直接用RDS的内网地址访问数据库)

           保存,退出(:wq)

           在浏览器中输入:服务器地址/phpMyAdmin/

          

输入用户名和密码,执行->

大功告成!!!


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 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!