21

I tried to create a virtual host magento.developers.com in Ubuntu 12.04 using XAMPP.
First I have edited the /opt/lampp/etc/extra/httpd-vhosts.conf and added the following lines:

<VirtualHost *:80>
    ServerAdmin webmaster@magento.developers.com
    DocumentRoot "/opt/lampp/htdocs/magento"
    ServerName magento.developers.com
    ErrorLog "logs/magento.developers.com-error_log"
    CustomLog "logs/magento.developers.com-access_log" common
</VirtualHost>


I have restarted XAMPP using the command sudo /opt/lampp/lampp restart and then I have edited
the hosts file and added:

127.0.0.1   magento.developers.com

Then I tried to access magento.developers.com using the browser and it's not accessing

/opt/lampp/htdocs/magento

What I have to do to make it work and access magento folder instead of htdocs (the root)?

4

3 に答える 3

29

The virtual hosts conf by defualt is disabled in httpd.conf, in order to allow virtual hosts
in XAMPP under Ubuntu you have to uncomment line 480 in httpd.conf:

MAINSTEP: Uncomment line 480 as below:

479. # Virtual hosts
480. Include etc/extra/httpd-vhosts.conf

The httpd.conf file is located under /opt/lampp/etc, to modify it just follow these steps:

1. run sudo gedit /opt/lampp/etc/httpd.conf
2. apply MAINSTEP

于 2012-06-04T08:20:33.890 に答える
0

仮想ホストの作成:-

sudo vi /opt/lampp/etc/httpd.conf

次の行のコメントを外します

Include etc/extra/httpd-vhosts.conf

コマンドの下に n 個のホストを作成します。

sudo nano /opt/lampp/etc/extra/httpd-vhosts.conf(ホスト エントリを入力します)。

sudo nano /etc/hosts                 (do host file entry)

その後、xamppを再起動します

sudo /opt/lampp/lampp restart
于 2017-08-11T07:22:09.510 に答える