VOGU手游网:值得大家信赖的游戏下载站!
发布时间:2021-06-04 16:38:02来源:VOGU手游网作者:VOGU手游网
上次便宜VPS和大家分享了有关在Debian 6下手动配置LAMP(Linux+Apache+PHP+MySQL)环境的系列教程,也承诺近期和大家分享在CentOS下的LAMP教程,看来这个“近期”要比大家想得还要快~今天我们继续相关的内容。其实从头到尾看下来,大家很快就会发现,其实CentOS和Debian很多东西都是相通的,不同的只是一些apt-get和yum这种形式上的东西,所以只要举一反三,相信Linux下Web环境的配置并不会给大家带来太多的烦恼。
本期教程目录
安装/配置Apache
安装/配置MySQL
安装/配置PHP
1.更新系统&安装Apache
yum update yum install httpd
推荐:使用如下命令备份Apache配置文件
cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup
为了给大家拓展思路,本次在CentOS上的教程,和大家分享Apache的另外一种绑定域名和创建虚拟机的方式~
2.编辑/etc/httpd/conf.d/vhost.conf,假设我们要绑定example.com和example.org两个域名,则参照下面内容加入文件,
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@example.com ServerName example.com ServerAlias www.example.com DocumentRoot /srv/www/example.com/public_html/ ErrorLog /srv/www/example.com/logs/error.log CustomLog /srv/www/example.com/logs/access.log combined </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@example.org ServerName example.org ServerAlias www.example.org DocumentRoot /srv/www/example.org/public_html/ ErrorLog /srv/www/example.org/logs/error.log CustomLog /srv/www/example.org/logs/access.log combined </VirtualHost>
3.因为我们上文指定了几个目录而这几个目录还不存在,所以,使用如下命令创建相应目录,
mkdir -p /srv/www/example.com/public_html mkdir /srv/www/example.com/logs mkdir -p /srv/www/example.org/public_html mkdir /srv/www/example.org/logs
4.启动Apache
/etc/init.d/httpd start
日后每次修改vhost.conf文件,都需要使用如下命令使Apache重新载入配置文件
/etc/init.d/httpd reload
5.设置Apache开机启动
/sbin/chkconfig --levels 235 httpd on
1.安装MySQL
yum install mysql-server
2.设置MySQL开机自动启动
/sbin/chkconfig --levels 235 mysqld on
3.启动MySQL
/etc/init.d/mysqld start
MySQL的配置文件位于/etc/my.cnf
4.安装mysql_secure_installation(MySQL安全设置)
mysql_secure_installation
5.附上常用的MySQL命令
登录MySQL
mysql -u root -p
创建数据库vmvps(注意MySQL命令行下都需要以;结尾),并将该数据库所有权限赋予vmvps_user(密码为123)
create database vmvps; grant all on vmvps.* to 'vmvps_user' identified by '123';
退出MySQL
quit
1.安装PHP
yum install php php-pear php-mysql
2.编辑配置文件/etc/php.ini,修改如下内容
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR display_errors = Off log_errors = On error_log = /var/log/php.log max_execution_time = 300 memory_limit = 64M register_globals = Off
最后,重启Apache,大功告成~
/etc/init.d/httpd restart
神雕侠侣2手游氪金玩家消费指南
食物语手游腊味合蒸高阶阵容打法思路一览
商道高手最佳上阵25人怎么搭配阵容
王牌战士据点占领怎么玩 游戏模式介绍
闪耀暖暖养不起表情包 闪耀暖暖表情包大全持续更新
王牌战士团战如何切入详细讲解
王牌战争文明重启手工炸弹怎么获得
王牌战争文明重启各种资源刷新地点与详细位置大全
和平精英超高音质怎么修改 超简单修改音质办法介绍
王者荣耀
角色扮演
斗罗大陆手游
角色扮演
一刀传世
角色扮演
梦三国
角色扮演
坠落星界
其它游戏
邪恶疯人院
休闲益智
征途永恒
角色扮演
和平精英
枪战射击
神雕侠侣2
角色扮演