在我的 Ubuntu 14.04 LTS 中,文檔根目錄設定為/var/www/html。它的配置在以下文件中:
/etc/apache2/sites-available/000-default.conf
所以只需做一個
sudo nano /etc/apache2/sites-available/000-default.conf
並將以下行更改為您想要的內容:
DocumentRoot /var/www/html
也做一個
sudo nano /etc/apache2/apache2.conf
並發現:
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
並更改/var/www/html為您喜歡的目錄並儲存。
儲存變更後,只需重新啟動 Apache 2 Web 伺服器即可完成:)
sudo service apache2 restart
先更新套件
sudo apt-get update
sudo apt-get upgrade
安裝Openssh伺服器
sudo apt install openssh-server
修改登錄文件讓root能遠端登入
編輯 /etc/ssh/sshd_config
sudo nano /etc/ssh/sshd_config
修改並增加
port 22 或是 port 8080
PasswordAuthentication yes
PermitRootLogin yes
啟動伺服器或重新啟動伺服器
sudo service ssh start
sudo service ssh restart
新增root密碼
sudo passwd root
輸入root密碼
安裝apache2伺服器
sudo apt install apache2
啟動apache2伺服器
sudo service 服務名稱 start
sudo service apache2 start