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

设置开机启动

systemctl enable mariadb.service

数据安全设置

mysql_secure_installation

安装phpmyadmin

yum install epel-release
yum install phpmyadmin

修改phpMyadmin的虚拟机配置

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
     Require all granted
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Allow from all
   </IfModule>
</Directory>

使其有权限访问

这篇文章目前没有评论。

回复

(必填项)

(必填项)

(可选)