Linux Mint – LAMP 的安裝 (3) – 讓使用者可以用 public_html 當個人網頁目錄
* 設定讓使用者可以用 public_html 當個人網頁目錄
mtchang@mtchang-virtual-machine /etc/apache2/mods-available $ sudo a2enmod userdir
Enabling module userdir.
To activate the new configuration, you need to run:
service apache2 restart
mtchang@mtchang-virtual-machine /etc/apache2/mods-available $ sudo service apache2 restart
* Restarting web server apache2
* 測試 public_html 驗證否正常工作?
mtchang@mtchang-virtual-machine /etc/apache2/mods-available $ cd ~
mtchang@mtchang-virtual-machine ~ $ ls
vmware-tools-distrib 下載 公共 圖片 影片 文件 桌面 模板 音樂
mtchang@mtchang-virtual-machine ~ $ mkdir public_html
mtchang@mtchang-virtual-machine ~ $ echo 'hello my person home' > /home/mtchang/public_html/index.html
mtchang@mtchang-virtual-machine ~ $ echo '<?php phpinfo(); ?>' > /home/mtchang/puublic_html/index.php
* 請直接使用 http://localhost/~mtchang/index.html 或是 http://localhost/~mtchang/index.php 觀看驗證。
* php 程式會當成文字顯示
mtchang@mtchang-virtual-machine ~ $ cd /etc/apache2/mods-enabled/
mtchang@mtchang-virtual-machine /etc/apache2/mods-enabled $ sudo nano php5.conf
mtchang@mtchang-virtual-machine /etc/apache2/mods-enabled $ sudo service apache2 restart
# 修改底下最後的部份,將它註解
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <ifmodule ...=""> to </ifmodule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<ifmodule mod_userdir.c="">
# <directory home="" *="" public_html="">
# php_admin_flag engine Off
# </directory>
#</ifmodule>
mtchang@mtchang-virtual-machine /etc/apache2/mods-enabled $ sudo service apache2 restart
* Restarting web server apache2
沒有留言:
張貼留言