安裝Ubuntu Server 16.04.1 LTS
更新安裝包目錄 sudo apt-get update
更新已安裝的應(yīng)用 sudo apt-get upgrade
安裝apache
sudo apt-get install apache2
安裝php5.6
由于Ubuntu16.04.1默認(rèn)獲取的php版本是php7.0埋合,因此需要其他目錄源
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
然后更新及安裝php
sudo apt-get update
sudo apt-get install php5.6
(如果已安裝其他版本,需先卸載然后安裝,參看 http://askubuntu.com/questions/756181/installing-PHP-5-6-on-xenial-16-04)
安裝mysql
sudo apt-get install mysql-server
其他模板安裝
sudo apt-get install libapache2-mod-php5.6
sudo apt-get install php5.6-mysql
sudo apt-get install php5.6-gd
基本配置完成
另:改變apache默認(rèn)訪問目錄
默認(rèn)訪問目錄為/var/www/html
修改為/var/www
sudo nano /etc/apache2/sites-enabled/000-default? ? 在文檔中找到 DocumentRoot 在后面修改要放置網(wǎng)頁文件的目錄(/var/www)
重啟apache
sudo /etc/init.d/apache2 restart