Domanda

Evening everyone,

Firstly, I apologize if this is the best location to ask this question so feel free to redirect me or this post :)

I have WAMP installed on C: but any projects will exist on a separate drive. I can create an alias to point to the correct directory just fine - no problem there. The problem lies in the fact that I want/need to have a custom URL assigned to each project (so instead of localhost/mysite it would be something similar to mysite.dev).

I found this article, but it's a bit old so I'm not sure if the information is still accurate. Here's what I have so far:

  • Edited hosts file to add domain - 127.0.0.1 mysite.dev
  • Edited WAMP's httpd.conf file to uncomment - Include conf/extra/httpd-vhosts.conf
  • Edited WAMP's httpd-vhost.conf file to add virtual host:
<VirtualHost 127.0.0.1>
    DocumentRoot "d:/projects/mysite/"
    ServerName mysite.dev
    ServerAlias mysite.dev
<VirtualHost>

In the end this produces no errors, just a big fat 403 Forbidden Access "You don't have permission to access / on this server."

No idea where to go from here, this isn't exactly my area of expertise :P any and all help/tips are greatly appreciated! Thanks!

È stato utile?

Soluzione 2

After another hour or two I can actually answer my own question.

Someone on another forum mentioned that you need to keep a mention of plain ol' localhost in the httpd-vhost.conf file, so here's what I ended up with in there:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "c:/wamp/www/"
</VirtualHost>

<VirtualHost *:80>
    ServerName platypus.dev
    DocumentRoot "d:/projects/test/"

    <Directory "d:/projects/test/">
        Options Indexes FollowSymLinks Includes
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Exit WAMP, restart - good to go. Hope this helps someone else :)

Altri suggerimenti

Try setting a port to listen for

<VirtualHost *:80>
    DocumentRoot d:/projects/mysite/
    ServerName mysite.dev
</VirtualHost>

Depending on which WAMP stack you're using, different, but very silimar configs in every stack. WAMP = (apache, mysql, php FOR Windows ... Win Ap My Php). There are different WAMP stacks, AMPPS, XAMPP, Bitnami.. You probably meaned WAMPserver (most people call it simply WAMP, but can mean also others, which has slightly different configs..)

If you're using WAMPserver, I think it's the easiest to config a "custom URL", that means virtual host. You just need to uncomment the vhosts config file in httpd.conf in apache's folder, and you already have a template of how to set virtual host in this file, there are 2 dummy hosts as examples. But, don't forget the Windows' "hosts" file, you need to set 127.0.0.1 [url_you_want] in your hosts file, and that [url_you_want] is the same in your apache vhosts config file as "ServerName"...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top