gpt4 book ai didi

php - Apache2 Ubuntu : Virtualhost redirects to localhost

转载 作者:行者123 更新时间:2023-12-04 18:51:53 26 4
gpt4 key购买 nike

我想为在我的计算机上运行的 apache2 设置一个虚拟主机。因此,当我浏览到:“invision.jan.pcsg”时,我从“/var/www/html/invision”获取页面内容/文件夹结构

这是我创建的虚拟主机文件“invision.jan.pcsg.conf”:

<VirtualHost invision.jan.pcsg:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/invision
ServerName invision.jan.pcsg
ServerAlias hkl.mor.pcsg hkl_at.mor.pcsg


<Directory />
Options FollowSymLinks
AllowOverride FileInfo
</Directory>
<Directory /var/www/html/invision/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

当我现在浏览到“invision.jan.pcsg”时,我被重定向到 localhost 并显示“php is working”页面。

当浏览到“jan.pcsg”时,会显示“/var/www”的文件夹内容。

有谁知道为什么会这样?

最佳答案

将您的 DocumentRoot 更改为您的 Web 应用程序(如果其 MVC 为“ View ”)所在的目录。
通常它的:DocumentRoot/home/www-data//

关于php - Apache2 Ubuntu : Virtualhost redirects to localhost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30600134/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com