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

Thursday, February 3, 2022

[FIXED] Virtual hosts not working on MAMP

 February 03, 2022     apache, mamp, virtualhost     No comments   

Issue

I am running into virtual hosts setup issues on MAMP. Here is my vhosts config

NameVirtualHost *

<VirtualHost *>
        ServerName dev.local.com
	DocumentRoot “/Applications/MAMP/htdocs/local”
</VirtualHost>

<VirtualHost *>
        DocumentRoot /Applications/MAMP/htdocs
        ServerName localhost
</VirtualHost>

Here is my hosts file

127.0.0.1       localhost
127.0.0.1       dev.local.com

now when visiting localhost and dev.local.com both are pointing to index of local directory. I tried various config setting in vhosts file but none is working. I am on MacBook Pro 10.10


Solution

Changed the hosts file like this -

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName dev.local.com
    DocumentRoot /Applications/MAMP/htdocs/local
    ServerAlias dev.local.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
</VirtualHost>


Answered By - user6166
  • 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