2014-10-30 74 views
0

我想在不同端口上配置多个站点。我的IP是192.168.50.4,端口80是标准的apache2站点“It works”。我想绑定Seound站点到端口*:8080。此端口绑定到“It works”站点,而不是我的自定义站点。在多个端口上配置站点

的/ etc/apache2的/网站可用/测试:

NameVirtualHost 192.168.50.4:8080 
Listen 8080 
<VirtualHost *:8080> 

     # Admin email, Server Name (domain name) and any aliases 
     ServerAdmin [email protected] 
     ServerName site1 
     #ServerAlias www.localhost 


     # Index file and Document Root (where the public files are loca$ 
     DirectoryIndex index.html, index.php 
     DocumentRoot /home/vagrant/www/vhosts/test.t/htdocs 

     <Directory /home/vagrant/www/vhosts/test.t/htdocs/> 
       Options Indexes FollowSymLinks 
       AllowOverride All 
       Require all granted 
       allow from all 
     </Directory> 

     # Custom log file locations 
     LogLevel warn 
     ErrorLog /home/vagrant/www/vhosts/test.t/log/error.log 
     CustomLog /home/vagrant/www/vhosts/test.t/log/access.log combin$ 

    </VirtualHost> 

回答

0

试试这个(大部分为清楚起见省略的配置):

<VirtualHost 192.168.50.4:8080> 
    DocumentRoot /home/vagrant/www/vhosts/test.t/htdocs 
</VirtualHost> 

确保您实际上已经启用并重新加载阿帕奇:

a2ensite test 
service apache2 reload 

并且还请确保您在正确的IP地址(e 。G。不是localhost127.0.0.1)。