Ubuntu中用XAMPP本地設定虛擬主機
阿新 • • 發佈:2018-11-09
sudo gedit /opt/lampp/etc/httpd.conf
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
去掉前面的#號
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
sudo gedit /etc/hosts
127.0.0.1 localhost
127.0.0.1 myaproject
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
<VirtualHost:*80> DocumentRoot "/opt/lampp/htdocs/myproject" DirectoryIndex index.php <Directory "/opt/lampp/htdocs/myproject"> Options All AllowOverride All Require all granted </Directory> </VirtualHost>
你的myproject目錄下新建一個index.php 測試一下
<?php
echo "Hello world!";
?>
sudo /opt/lampp/lampp start