0

Im on windows 10, trying to customize an url to use Laravel. I dont want to acess the url using public folder on it. Im using wamp and apache is running on port 8080. So I edit the file wamp\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf like this:

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


<VirtualHost *:80>
    DocumentRoot c:/wamp/www/laravel_test/blog/public
    ServerName laravel_test.dev    
</VirtualHost>

After that, I edit the file system32/drivers/etc/hosts with:

127.0.0.1 localhost

127.0.0.1 laravel_test.dev

And when I access the url laravel_test.dev it doesnt work. I tried to use this too on httpd-vhosts.conf:

<VirtualHost *:8080>

And it doesnt work either. I always restart the service on wamp, and nothing changes.

I couldnt install and configure the homestead properly, so im trying to use wamp now. Can somebody help me?

churros
  • 419
  • 1
  • 8
  • 20
  • 1
    Define "doesn't work". What happens? – ceejayoz Oct 06 '17 at 15:30
  • Firefox was unable to establish a connection to the server laravel_test.dev. – churros Oct 06 '17 at 15:35
  • 1
    First, I'd start using `laravel-test.dev`, not `laravel_test.dev`. Underscores aren't valid in a domain. Have you confirmed that Apache is *listening* on port 80? https://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port – ceejayoz Oct 06 '17 at 15:41
  • Its listening on port 8080. I changed to laravel-test.dev. Still the same. – churros Oct 06 '17 at 15:45
  • Well, that's your issue. It needs to be listening to port 80 to be accessed without a port in the URL. – ceejayoz Oct 06 '17 at 15:49
  • Ok, so, in order to keep using the port 8080 for apache, what changes do I have to make? – churros Oct 06 '17 at 15:54
  • Listen on both 80 and 8080, and change your VirtualHosts to `` so they respond to both. – ceejayoz Oct 06 '17 at 15:55
  • The problem is that skype is conflicting with apache. Thats why I changed to port 8080. Is there a way to use only port 8080 for apache and access the project with laravel-test.dev? – churros Oct 06 '17 at 15:59
  • 1
    Turn that horrible Skype feature [off](https://stackoverflow.com/questions/22994888/why-skype-using-http-or-https-ports-80-and-443), then proceed with making Apache run on port 80. No, you can't access sites without a port on anything other than port 80 (or 443 for SSL). Typing `laravel-test.dev` in the browser tells that browser to access `laravel-test.dev` on port 80. – ceejayoz Oct 06 '17 at 16:02
  • (Or suck it up and use 8080 for development. You shouldn't be using WAMP for production, and the `:8080` shouldn't matter at all during local dev.) – ceejayoz Oct 06 '17 at 16:03
  • I went back to port 80 for apache on wamp, now it works. Thanks! – churros Oct 06 '17 at 16:06

1 Answers1

0

In your httpd.conf file you need to uncomment the virtual Hosts section

Then,

Your vhost needs to listen on port 8080

<VirtualHost *:8080>
 ServerName laraveltest.dev
 ServerAlias www.laraveltest.dev 
 DocumentRoot c:/wamp/www/laravel_test/blog/public
   <Directory "c:/wamp/www/laravel_test/blog/public">
  AllowOverride All
 Options Indexes MultiViews FollowSymLinks
  Require all granted
</Directory>
</VirtualHost>

For your hosts file

127.0.0.1 laraveltest.dev www.laraveltest.dev
rbur0425
  • 479
  • 8
  • 26