2017年3月23日 星期四

ubuntu 16.04 install apache2 php7 & mariadb

1.切換最高權限
   sudo su
2.安裝mariadb server & client
   apt-get -y install mariadb-server mariadb-client
3.資料庫安全設置
   mysql_secure_installation


  Enter current password for root (enter for none): <-- press enter
  Change root password? [Y/n] <-- y
  New password: <-- Enter the new MariaDB root password here
  Re-enter new password: <-- Repeat the password
  Remove anonymous users? [Y/n] <-- y
  Disallow root login remotely? [Y/n] <-- y
  Reload privilege tables now? [Y/n] <-- y

   mysql -u root -p  使用新密碼登入測試

4.安裝apache 2.4
     apt-get -y install apache2
5.安裝php 7.0
     apt-get -y install php7.0 libapache2-mod-php7.0

   systemctl restart apache2 重啟apache


   nano /var/www/html/info.php


<?php
phpinfo();
?>


   chown www-data:www-data /var/www/html/info.php


   瀏覽器打開 http://192.168.x.xx/info.php  (ip查詢 ifconfig)

   apt-cache search php7.0


  apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache  php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext

  
6.新增url rewrite
    sudo a2enmod rewrite
systemctl restart apache2

   打開 http://192.168.x.xx/info.php 檢查是否有mod_rewrite
7.
   apt-get -y install php-apcu
  systemctl restart apache2
8.Enable the SSL website in apache
   a2enmod ssl
  a2ensite default-ssl
  systemctl restart apache2
9.Install phpMyAdmin
   apt-get -y install phpmyadmin

  Web server to configure automatically: <-- Select the option: apache2
Configure database for phpmyadmin with dbconfig-common? <-- Yes
MySQL application password for phpmyadmin: <-- Press enter, apt will create a random password automatically.
 如果http://192.168.x.xx/phpmyadmin/ 找不到

1.apache 2的環境設定檔內加

  <Directory />
AllowOverride All </Directory>

2.加路徑關聯
  sudo ln -s /usr/share/phpmyadmin /var/www/html/




















沒有留言:

張貼留言