为什么我的xampp服务器下载index.php而不是访问本地网站?

问题描述 投票:0回答:1

我在 Linux Ubuntu 24.04 LTS 上下载了 xampp 我正确配置了虚拟主机 我配置了 Linux 主机文件以及 httpd.conf 文件 我调整了 htdocs 文件夹的权限,但是当我访问网站时 http://mywebsite.localhost它下载的是index.php而不是访问。

分别是我的httpd-vhosts.conf和hosts文件。

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/opt/lampp/htdocs/mywebsite"
    ServerName mywebsite.localhost
    ErrorLog "logs/mywebsite-error_log"
    CustomLog "logs/mywebsite-access_log" common
</VirtualHost>

127.0.0.1 localhost
127.0.1.1 LaptopUbuntu24
127.0.0.1 mywebsite.localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我寻找了一些教程,但没有解决我的问题。

php linux xampp virtualhost vhosts
1个回答
0
投票

查看您的 .htaccess,如果您可能有一行包含“AddHandler ...”的行,请将其注释掉并重试

您也可以检查这个旧问题及其答案PHP xampp 下载我的index.php 而不是加载页面

© www.soinside.com 2019 - 2024. All rights reserved.