Apache 多域名同端口同IP配置
如果原来的httpd.conf是正确的话,请保持不动,然后现最后的一行加上这两句:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
然后打开httpd.conf同一目录下的extra/httpd-vhosts.conf文件
修改如下:
<VirtualHost *:80>
ServerAdmin XX@XX.com
DocumentRoot "X:/wwwroot/web"
ServerName XX.XX.cn
ServerAlias XX.XX.cn
ErrorLog "logs/XX.XX.cn-error.log"
CustomLog "logs/XX.XX.cn-access.log" common
<Directory "X:/wwwroot/web">
Order allow,deny
Allow from all
DirectoryIndex index.asp index.html index.php index.htm Default.htm Default.aspx index.aspx
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin XX@XX.com
DocumentRoot "X:/wwwroot/web1"
ServerName XX.XX.org
ServerAlias XX.XX.org
ErrorLog "logs/XX.XX.org-error.log"
CustomLog "logs/XX.XX.org-access.log" common
<Directory "X:/wwwroot/web">
Order allow,deny
Allow from all
DirectoryIndex index.asp index.html index.php index.htm Default.htm Default.aspx index.aspx
</Directory>
</VirtualHost>
然后重启Apache,就OK了
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步