Xampp虚拟主机错误500

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

我在mac os上使用xampp,我想在其上添加虚拟主机

我在apache配置上使用此代码

<VirtualHost 127.0.0.1:80>
    ServerName mvcproject.local
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mvcproject/public"
</VirtualHost>

<Directory "/Applications/XAMPP/xamppfiles/htdocs/mvcproject/public">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

并像这样改变我的主人

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
127.0.0.1       Masouds-MacBook-Pro.local # added by Apache Friends XAMPP
127.0.0.1       mvcproject.local

但我有这个错误

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

错误500

mvcproject.local Apache / 2.4.33(Unix)OpenSSL / 1.0.2o PHP / 7.2.5 mod_perl / 2.0.8-dev Perl / v5.16.3

我怎么解决这个问题?!谢谢。!

php apache server xampp virtualhost
1个回答
0
投票

这些有助于在mac上创建虚拟主机

  1. 此文件中的/Applications/XAMPP/xamppfiles/etc/httpd.conf取消注释包含行 Virtual hosts Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
  2. 将您的站点添加到vhosts文件/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf我的自定义主机

<VirtualHost *:80>
    ServerName mysite.local
    DocumentRoot "/Users/yourusername/path/to/your/site"
    <Directory "/Users/yourusername/path/to/your/site">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/mysite.local-error_log"
</VirtualHost>
  1. 编辑主机文件

     sudo nano /etc/hosts
    #Add the following line
    127.0.0.1 mysite.local
  1. 重启你的XAMPP
© www.soinside.com 2019 - 2024. All rights reserved.