我想在差异端口上配置多个站点。我的IP是192.168.50.4,端口80是标准的apache2站点"它工作"。我想绑定secound站点到端口*:8080。这个端口绑定到"它工作"网站而不是我的自定义网站。
的/ 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>
答案 0 :(得分:0)
请尝试此操作(为清晰起见,省略了大部分配置):
<VirtualHost 192.168.50.4:8080>
DocumentRoot /home/vagrant/www/vhosts/test.t/htdocs
</VirtualHost>
确保您实际启用了该网站并重新加载了Apache:
a2ensite test
service apache2 reload
并确保您在正确的IP地址下访问它(例如,不是localhost
或127.0.0.1
)。