Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This question already has an answer here:

I am trying to setup an mobile app that I have received from another dev locally on my machine, this is a cordova based mobile app that is basically html5/javascript etc..

I have added the following line to my .hosts file:

127.0.0.1 app.myapps.local
127.0.0.1 localhost # existing line has always been there #

In my version of WAMP my virtual hosts are found within the following directory:

C:\wamp\vhosts\local.conf

In my virtual hosts file (there are lots of existing vhosts in there) I have added the following new addition

<VirtualHost *:80>
  ServerAdmin me@website.com
  DocumentRoot "c:/wwwroot/app/App/www/app.html"
  ServerName app.myapps.local
<Directory "c:/wwwroot/app/App/www/app.html">
    Options +Indexes
    AllowOverride All
</Directory>
  ErrorLog "c:/wwwroot/app/log/error.log"
  CustomLog "c:/wwwroot/app/log/access.log" common
  LogLevel debug
  SetEnv MANGO_ENVIRONMENT ME
</VirtualHost>

I have restarted apache and flushed the dns but for some reason everytime I load up app.myapps.local in the browser I am presented with the default WAMPSERVER homepage.

Can anyone suggest what could be wrong in my setup?

-- UPDATE -- I have noticed that app.myapps.local seems to behave like an alias to http://localhost for some reason, for instance I have test website with the local url of localhost/test however if I do app.myapps.local/test I get the same content as localhost/test.

Any ideas on why this is happening?

share|improve this question

marked as duplicate by HopelessN00b Feb 25 at 5:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 1 down vote accepted

try adding ServerAlias app.myapps.local to your vhost conf under ServerName line.

also, I just noticed that your Directory and DocumentRoot directives are pointing to a file rather than a directory. I've never seen that before and am not sure if that's correct.

If you need app.html to be the default html (index), use:

DirectoryIndex app.html

--Suggested vhost.conf--

<VirtualHost *:80>
  ServerAdmin me@website.com
  DocumentRoot "c:/wwwroot/app/App/www"
  ServerName app.myapps.local
  ServerAlias app.myapps.local
  DirectoryIndex app.html
<Directory "c:/wwwroot/app/App/www">
    Options +Indexes
    AllowOverride All
</Directory>
  ErrorLog "c:/wwwroot/app/log/error.log"
  CustomLog "c:/wwwroot/app/log/access.log" common
  LogLevel debug
  SetEnv MANGO_ENVIRONMENT ME
</VirtualHost>
share|improve this answer
    
thanks for that tip - I have noticed that my app.myapps.local is mimicking the same thing as localhost So for instance.. app.myapps.local/myothersite localhost/myothersite Are both displaying the exact same content?? Any ideas what I have done wrong –  Zabs Aug 14 '14 at 15:08
    
P.S I added your extra lines of code but have the same problem, thanks for tip with DirectoryIndex as I am sure that will need to be included once the other problem is fixed –  Zabs Aug 14 '14 at 15:18
    
I'm assuming you're using the "/" (forward-slash) as a delimiter and that is not a path.(?) I'd check the other vhosts conf files to see if they have the ServerAlias directives set. see: httpd.apache.org/docs/2.2/vhosts/name-based.html –  Satalink Aug 14 '14 at 15:19
    
did you change the DocumentRoot and Directory lines? –  Satalink Aug 14 '14 at 15:20
    
I have kept the DocumentRoot & Directory lines as it appears above in your suggest vhost conf edit. One of the existing working vhosts has DocumentRoot in the following manner DocumentRoot "c:/wwwroot/tyres_v2/public_html" –  Zabs Aug 14 '14 at 15:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.