阿里云linux ecs服务器配置apache+php环境
我们需要安装的软件有apache,php和MySQL。
首先关闭SELINUX(SELINUX是一个安全子系统,它能控制程序只能访问特定文件。如果不关闭,你可能访问文件受限):
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq!#保存退出
shutdown -r now#重启系统
然后安装apache
yum install httpd #根据提示,输入Y安装即可成功安装
/etc/init.d/httpd start#启动Apache
备注:Apache启动之后会提示错误:
正在启动 httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName
解决办法:
vi /etc/httpd/conf/httpd.conf #编辑
找到 #ServerName www.example.com:
修改为 ServerName www.jbaobao.net: #这里设置为你自己的域名,如果没有域名,可以设置为localhost
:wq! #保存退出
chkconfig httpd on #设为开机启动
/etc/init.d/httpd restart #重启Apache
安装mysql
yum install mysql mysql-server #询问是否要安装,输入Y即可自动安装,直到安装完成
/etc/init.d/mysqld start #启动MySQL
chkconfig mysqld on #设为开机启动
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
然后为mysql的root账号设置密码(默认的是空)
mysql_secure_installation回车 这里需要注意的是,如果你是新安装的mysql,会弹出如下提示:
In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here.
Enter current password for root (enter for none):
大概意思就是如果你是新安装的话,你的默认密码是空,直接按enter键就可以了 然后设置新的密码,输入两次。 再然后,会有若干个提示:
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] y
... Success!
大概意思是,mysql会默认创建一个匿名用户,方便你测试什么的,现在问你要不要删掉它,果断删掉 Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y
... Success!
大概意思是,root用户默认只能访问localhost,以防止有人猜你的密码。。。问你是否禁止root登陆,也选yes,虽然基本上不会有人来猜吧。。。 By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y
大概意思是,mysql默认创建了一个名为test的数据库,这个库任何人都可以访问,问你是不是要把它删掉,也删掉。 Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y 大概意思是,上面所有的修改是否马上生效,选y 总之就是一路Yes。。。。
最后出现:Thanks for using MySQL! MySql密码设置完成,重新启动 MySQL:
/etc/init.d/mysqld restart #重启
最后一步,安装php
yum install php #根据提示输入Y直到安装完成
#安装PHP组件,使 PHP5 支持 MySQL
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt #这里选择以上安装包进行安装,根据提示输入Y回车
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/httpd restart #重启Apche
OK,到这里,所有的软件都安装完了,现在测试一下。
默认的,你会有一个www的文件夹,里面有个html的文件夹,你的默认访问路径就是这里。
cd /var/www/html
vi index.php #编辑输入下面内容
<?php
echo "hello my server!";
?>
:wq! #保存退出
然后在浏览器里键入你的公网ip,顺利的话,你就开启自己第一个页面了!~
阿里云linux ecs服务器配置apache+php环境的更多相关文章
- 阿里云linux centos 一键部署web环境--图文详解
一.购买阿里云服务器ECS 1,登录阿里云,选择阿里云服务器ECS 2,创建实例 或 3,选好配置 4,完成配置 注:记住用户名和密码 二.一键配置linux环境 1,下载xshell,安装成功后,建 ...
- 阿里云 Linux 启用465端口发送邮件
阿里云 Linux 启用465端口发送邮件 环境:阿里云 Linux Centos 7.4 x64 注:阿里云默认禁用25邮件端口,需要启动465端口加密进行邮件发送. 注:确保邮箱开启SMTP服务, ...
- 阿里云服务器部署php的laravel项目,在阿里云买ECS 搭建 Linux+Nginx+Mysql+PHP环境的
在阿里云买ECS的时候选择自己习惯的镜像系统,我一般都是使用Linux Ubuntu,所以,以下的配置都是在Ubuntu 14.04稳定支持版的环境中搭建Linux+Nginx+Mysql+PHP环境 ...
- 阿里云(ECS)Centos服务器LNMP环境搭建
阿里云( ECS ) Centos7 服务器 LNMP 环境搭建 前言 第一次接触阿里云是大四的时候,当时在校外公司做兼职,关于智能家居项目的,话说当时俺就只有一个月左右的 php 后台开发经验(还是 ...
- 阿里云服务器 ECS 部署lamp:centos+apache+mysql+php安装配置方法 (centos7)
阿里云服务器 ECS 部署lamp:centos+apache+mysql+php安装配置方法 (centos7) 1.效果图 1 2. 部署步骤 1 1. mysql安装附加(centos7) 7 ...
- 【简书】在阿里云自带的CentOS + LAMP环境下部署一个Laravel项目
在阿里云自带的CentOS + LAMP环境下部署一个Laravel项目 作者 DonnieZero 关注 2017.07.29 22:02* 字数 2218 阅读 5556评论 3喜欢 1赞赏 1 ...
- 阿里云服务器 ECS Ubuntu系统安装配置
1. 登陆服务器 系统开通成功后手机会收到阿里云发来的短信,包含公网IP及root登录密码. WEB管理后台方式 可通过阿里云管理后台选择“连接管理终端…”进行登录 提示输入VNC密码 登录成功后显示 ...
- 压力测试(六)-阿里云Linux服务器压测接口实战
1.SpringBoot 接口打包,并用jar包方式部署 简介:用jar包方式在控制台进行启动 打包 mvn package && java -jar target/gs-spring ...
- 阿里云Linux服务器初探
阿里云Linux服务器初探 阿里云Linux服务器初探 因为钱包的关系,本人买了一个660元2年的1核1GB的小服务器(centos是Linux的发行版),在当初是用2核4GB(内存)的时候使用的是w ...
随机推荐
- R自动数据收集第二章HTML笔记1(主要关于handler处理器函数和帮助文档所有示例)
本文知识点: 1潜在畸形页面使用htmlTreeParse函数 2startElement的用法 3闭包 4handler函数的命令和函数体主要写法 5节点的丢弃,取出,取出标签名称.属性.属 ...
- Xcode查找内存泄漏
- ELK 集中日志分析 windows部署实战
一步步来 1.下载软件 Elasticsearch: https://download.elasticsearch.org/...p/elasticsearch/2.0.0/elasticsearch ...
- 导出excel报错
System.ComponentModel.Win32Exception: 拒绝访问 1.问题现象: foreach (System.Diagnostics.Process thispro in Sy ...
- Bestcoder#5 1002
Bestcoder#5 1002 Poor MitsuiTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- Python绘图
1.二维绘图 a. 一维数据集 用 Numpy ndarray 作为数据传入 ply 1. import numpy as np import matplotlib as mpl import mat ...
- bind绑定参数
const curry = (fn) => (...args)=>fn.bind(null,...args); const split = curry((splitOn, str) =&g ...
- Apache commons-configuration setDelimiterParsingDisable不生效的处理
Apache commons-configuration setDelimiterParsingDisable不生效的处理 项目中有用到commons-configuration,版本1.9. 配置初 ...
- Linux时间同步
(1)进入 root权限 su root(2)使用ntpdate IP(时间源IP)或service crond restart查看服务有没有开启(3)#crontab -e(新增一下语句) 0 */ ...
- awk
cat map-matcher.log | awk -F '[' '{print $1}' | awk -F '-' '{print $2}' >result.txt cat 2.txt | a ...