CentOS 6下手动安装LAMP环境(通用版)

CentOS 6下手动安装LAMP环境(通用版),第1张

CentOS6下手动安装LAMP环境(通用版)

当前教程目录
1。安装/配置Apache
2。安装/配置MySQL
3。安装/配置PHP

I.安装/配置Apache

1.更新系统并安装Apache
yum更新
yum安装httpd

强烈建议:使用以下说明来备份Apache配置文件
CP/etc/httpd/conf/httpd.conf~/httpd.conf.backup。

为了拓展思路,CentOS上的这篇教程将把Apache的其他相关网站域名和建立vm虚拟机的方法分享给大家~

2.写/etc/httpd/conf.d/vhost.conf,假设有人想把example.org2和example.org2的域名关联起来,参考以下内容添加文档,
namevutialhost*:80。


[email protected]
ServerNameexample.com
serveraliaswww.example.com
documentroot/SRV/www/example.com/public_html/
errorlog/SRV/www/example.com/logs/error.log
CustomLog/SRV/www/example.com/logs


[email protected]
ServerNameexample.org
serveraliaswww.example.org
documentroot/SRV/www/example.org/public_html/
errorlog/SRV/www/example.org/logs/error.log
customlog/SRV/www/example.org/logs

3.由于人们在上面指定了很多目录,现在还找不到,所以应该使用下面的说明来建立相对目录,
mkdir-p/SRV/www/example.com/public_html
mkdir/SRV/www/example.com。

mkdir-p/SRV/www/example.org/public_html
mkdir/SRV/www/example.org/logs

4.启动Apache
/etc/init.d/httpdstart

以后每次更改vhost.conf文件时,都必须使用下面的指令让Apache再次加载配置文件
/etc/init.d/HTTpreload。

5.将Apache设置为启动并运行
/sbin/chkconfig–levels235httpdon

其次,安装/配置MySQL

1.安装MySQL
yum安装MySQL-server。

2.将MySQL设置为自动启动
/sbin/chkconfig–levels235mysqldon

3.启动MySQL
/etc/init.d/mysqldstart

MySQL配置文档位于/etc/my.cnf。

4.安装MySQL_secure_installation
MySQL_secure_installation

5.附上常用MySQL说明。

登录MySQL
mysql-uroot-p

创建数据库iaodun(注意,所有MySQL命令必须以;末尾),并将数据库查询的完全管理权限授予iaodun_user(登录密码为123)
创建数据库iodun
在iaodun上全部授予。*发送给由“123”标识的“iaodun_user”;

退出MySQL
退出

三。安装/配置PHP

1.安装PHP
yum安装PHPPHP-pearPHP-MySQL

2.编写配置文档/etc/php.ini,更改以下内容
error_reporting=e_compile_error|e_recoverable_error|e_error|e_core_error
display_errors=Off
br/]error_log=/var/log/PHP.log
max_execution_time=300

终于重启了Apache,而且大获全胜~
/etc/init.d/httpd重启。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/744874.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-29
下一篇 2022-04-29

发表评论

登录后才能评论

评论列表(0条)

保存