Apache 在多个端口上配置站点

Apache 在多个端口上配置站点,apache,apache2,debian,Apache,Apache2,Debian,我想在不同的端口上配置多个站点。我的IP是192.168.50.4,端口80上是标准的apache2站点“ItWorks”。我要将secound站点绑定到端口*:8080。此端口绑定到“It works”站点,而不是我的自定义站点 /etc/apache2/可用场地/测试: NameVirtualHost 192.168.50.4:8080 Listen 8080 <VirtualHost *:8080> # Admin email, Server Name (doma

我想在不同的端口上配置多个站点。我的IP是192.168.50.4,端口80上是标准的apache2站点“ItWorks”。我要将secound站点绑定到端口*: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 webmaster@test.t
      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>
NameVirtualHost 192.168.50.4:8080
听8080
#管理员电子邮件、服务器名(域名)和任何别名
服务器管理员webmaster@test.t
服务器名站点1
#ServerAlias www.localhost
#索引文件和文档根目录(其中公共文件为loca$
DirectoryIndex.html,index.php
DocumentRoot/home/vagrant/www/vhosts/test.t/htdocs
选项索引跟随符号链接
允许超越所有
要求所有授权
通融
#自定义日志文件位置
日志级别警告
ErrorLog/home/vagrant/www/vhosts/test.t/log/error.log
CustomLog/home/vagrant/www/vhosts/test.t/log/access.log组合$
试试这个(为了清楚起见,省略了大部分配置):

并确保您在正确的IP地址下访问它(例如,不是
localhost
127.0.0.1

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