PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 17, 2022

[FIXED] Creating a Virtual Host for Apache MAMP

 February 17, 2022     apache, mamp, php, virtualhost     No comments   

Issue

I'm trying to create a virtual host on my MAMP setup so I can access http://api.localhost for a PHP API I'm trying to build with Slim. Here's the code I've appended to my httpd.conf file:

Name VirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
    DocumentRoot "/Applications/MAMP/htdocs/slim"
    ServerName api.localhost
</VirtualHost>

When I restart the server and try to start it up again with this new configuration, it simply won't load. I commented out the new code and it loads fine. Any ideas?


Solution

try to use this line

<VirtualHost *:80>

instead of yours

and I think you can remove the first line too...



Answered By - Simon Berka
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing