0
votes

i use xampp on mac os and i want to add virtual host on it

i use this code on apaceh config

<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>

and change my host like this

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

but i have this error

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.

Error 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

How can i solve this problem?! thanks.!

1
Are you sure that the CGI script actually is not the problem?RiggsFolly
what is the CGI Script!?Masoud Khani
I assumed you had a CGI script becaue you added ExecCGI and that is mentioned in the error messageRiggsFolly
How can i Solve this Problem!?Masoud Khani

1 Answers

0
votes

These are some point to help in create virtual host on mac

  1. /Applications/XAMPP/xamppfiles/etc/httpd.conf in this file uncomment the include line

    Virtual hosts Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

  2. Add your site into vhosts file /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf My custom host

<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. Edit your host file

     sudo nano /etc/hosts
    #Add the following line
    127.0.0.1 mysite.local
  1. Restart your XAMPP