pat-och
pat-och

Reputation: 345

first VirtualHost must be localhost in httpd-vhosts.conf

Context: fresh wampserver 3.x install (windows10) port 80 was used by microsoft iis so i change the port using wampserver tool (right click on the icon). Wampserver manage itself to change the port with 8080.

at this moment, httpd-vhosts.conf content is

# Virtual Hosts
#
<VirtualHost *:8080>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

and hosts content is:

#
127.0.0.1 localhost:8080
::1 localhost:8080

Purpose: create virtualhost for my project like http://myproject.localdev instead of http://localhost:8080/myproject/public/

what's going bad ? by using wampserver link to create virtualhost, i got the error message below

first VirtualHost must be localhost in c:/wamp64/bin/apache/apache2.4.33/conf/extra/httpd-vhosts.conf

Upvotes: 0

Views: 5110

Answers (1)

Andrey Mokhov
Andrey Mokhov

Reputation: 11

I used 8080 port too and had the same problem. What I've done - in httpd-vhosts.conf I added localhost with port 80 anyway, so I had both port 80 and port 8080:

<VirtualHost *:80>
  ServerName localhost
....
<VirtualHost *:8080>
  ServerName localhost

After that I opened localhost:8080 - there was a warning "Port used for the VirtualHost is not an Apache Listen port". Newertheless I clicked "Add a Virtual Host". The new host was added, then I restarted DNS (WAMP - Tools - Restart DNS).

After all you can delete from httpd-vhosts.conf localhost:80

Upvotes: 1

Related Questions