Linux使用Centos
一封豪、安裝Apache
sudo yum install httpd #安裝Apache
sudo systemctl start httpd #啟動Apache
sudo systemctl enable httpd #設(shè)置開機啟動
驗證是否安裝成功
http://your_server_IP_address/ 如果能看到默認的centos網(wǎng)頁佛点,則證明安裝成功
二、安裝MariaDB
MariaDB數(shù)據(jù)庫管理系統(tǒng)是MySQL的一個分支挂洛,主要由開源社區(qū)在維護礼预,采用GPL授權(quán)許可。開發(fā)這個分支的原因之一是:甲骨文公司收購了MySQL后虏劲,有將MySQL閉源的潛在風(fēng)險托酸,因此社區(qū)采用分支的方式來避開這個風(fēng)險褒颈。Centos 7采用MariaDB服務(wù)器
sudo yum install mariadb-server mariadb #安裝
sudo systemctl start mariadb #啟動
#運行一個簡單的安全腳本,它將刪除一些危險的默認值励堡,并鎖定對數(shù)據(jù)庫系統(tǒng)的訪問谷丸。運行以下命令啟動交互式腳本:
sudo mysql_secure_installation
sudo systemctl enable mariadb #設(shè)置開機啟動
三、安裝php
sudo yum install php php-mysql #安裝
sudo systemctl restart httpd #重新啟動Apache Web服務(wù)器才能使用PHP
驗證是否安裝php成功
sudo vi /var/www/html/info.php
#centos 7 apache網(wǎng)站主目錄下創(chuàng)建info.php应结,并填入內(nèi)容<?php phpinfo(); ?>
http://your_server_IP_address/info.php 如果能在網(wǎng)頁中看到php相關(guān)信息刨疼,則證明安裝成功
info.php可能會將您的服務(wù)器信息提供給未經(jīng)授權(quán)的用戶,所以測試后可以刪除該文件
sudo rm /var/www/html/info.php