Centos 7 搭建LAMP环境

安装Apache

sudo yum install httpd
httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Jun 27 2018 13:48:59


配置ServerName
vi /etc/httpd/conf/httpd.conf

ServerName localhost:80

配置虚拟主机
vi /etc/httpd/conf.d/vhosts.conf
输入下面内容

<VirtualHost *:80>
  ServerAdmin i@sobird.me
  DocumentRoot “/home/sobird/www"
  <Directory /home/sobird/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    Require all granted
  </Directory>
</VirtualHost>

启动

systemctl start httpd

设置开机启动

systemctl enable  httpd

安装PHP

yum install php php-devel

安装Mysql

yum install mariadb-server
yum install php-mysql

启动mysql

systemctl start mariadb.service

数据安全设置

mysql_secure_installation

安装phpmyadmin

yum install epel-release
yum install phpmyadmin

修改phpMyadmin的虚拟机配置

AddDefaultCharset UTF-8

Require all granted


# Apache 2.2
Order Deny,Allow
Allow from all


使其有权限访问

这篇文章目前没有评论

Leave a Reply

(必填项)

(必填项)

(可选)