我有一個VPS,我已經在其中安裝了XAMPP,並配置了所有安全性。我已經啓用了虛擬主機。我有一個db.example.com
,它將直接在網上打開phpMyAdmin
。XAMPP默認虛擬主機
如下的httpd-vhosts.conf
的條目:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/phpmyadmin"
ServerName db.example.com
ServerAlias www.db.example.com
ErrorLog "logs/db.example.com-error_log"
CustomLog "logs/db.example.com-access_log" common
<Directory "/opt/lampp/phpmyadmin">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
假設1.2.3.4
是我的example.com IP。爲了訪問db.example.com(1.2.3.4),我將在我的本地/etc/hosts
文件中添加條目。
我的httpd-vhsots.conf
中還有其他子域的條目,這些子域完美地工作。要注意的是,在vhosts
條目db.example.com
是文件中第一httpd-vhsost.conf
現在,這是問題:
當我在瀏覽器中直接打開IP 1.2.3.4
,phpMyAdmin
打開,這不應該實際上發生。如何避免這種情況?我不知道爲什麼會發生這種情況。
PS:我除去db.example.com我的本地條目/etc/hosts