2018年7月13日 星期五

CENTOS7布置LAMP環境

1.apache

yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

安裝https然後防火牆打開

vim /etc/httpd/conf/httpd.conf

找到3個

AllowOverride none

修改成

AllowOverride All

Require all denied刪除

systemctl restart httpd

查看httpd狀態
systemctl status httpd

2.MariaDB

yum install mariadb-server mariadb

systemctl start mariadb

mysql_secure_installation

systemctl enable mariadb.service
開機預設執行

3.php

yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap php-mcrypt curl zlib

4.phpmyadmin
yum -y install epel-release
yum -y install phpmyadmin
systemctl restart httpd

vi /etc/httpd/conf.d/phpMyAdmin.conf
找到IP,修改允許登入IP

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

這邊修改目錄別名,改掉預設的phpmyadmin資料夾名稱
 
<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8
 
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 1.2.3.4/24
這邊改允許的IP
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>


重啟 apache 

# systemctl restart httpd




沒有留言:

張貼留言