简体   繁体   中英

MAMP just ONE virtual host not working

I wanted to start a (my first) wordpress project on my mac. I run apache with MAMP, and wanted to make another (I allready have a few) virtual host for this particular project. I added the host to my httpd.conf and etc/hosts file as i've done many times before. When I browse to the url i've chosen I just end up in the directory that i've specified as root folder in my MAMP settings. Apache seems to ignore the changes made in the httpd.conf file, but if I remove (rename) the httpd.conf file (to _httpd.conf) it apache doesn't start. so it looks like changes to this file are ignored, BUT if I put something wrong in the file apache doesn't start either... this is what I put in the httpd.conf file to add a virtual host:

<VirtualHost *>
  DocumentRoot "/Users/username/Sites/site_dir/"
  ServerName local.sitename.com
  <Directory "/Users/username/Sites/site_dir/">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

can this have anything to do with WP?

greets, R.

On Windows:

Try putting it in the conf/extras/httpd-vhosts.conf instead and try where port 80 is whatever port you have apache running on (:80 by default on windows)

and try not to use .org .com or any ending common on the web in your server name/alias use if you are developing the project on your localhost use something like sitename.local instead.

On Mac: Not sure how it would work

On Ubuntu 11.04: I just:

  1. Set up a different vhost file for each site inside of /etc/apache2/sites-available
  2. Then enable the site via a2ensite or just make a copy to the file using cp to the sites-enabled folder (all this is done via the ssh or a terminal on mac)
  3. I then reload and restart apache and wallah!

I'm having a similar problem on one of my ubuntu servers. I'm doing something that I've done several times but all of a sudden it doesn't work. Go figure, lol! Typo? Who knows, definitely scour the web, an answer is sure to surface.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM