0

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?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Zabs
  • 191
  • 2
  • 3
  • 10

1 Answers1

1

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>
Satalink
  • 178
  • 7
  • thanks for that tip - I have noticed that my http://app.myapps.local is mimicking the same thing as http://localhost So for instance.. http://app.myapps.local/myothersite http://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: http://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
  • that looks ok. public_html should be a directory (rather than public.html which would be a file). – Satalink Aug 14 '14 at 15:41
  • can you post the vhost configs for the three instances that are pointing to the same content? – Satalink Aug 14 '14 at 15:41
  • It may have to do with the order in which the virtual hosts conf files are loaded. If you're adding them to the httpd.conf file, the order in which they are listed. The first becomes the default.. You'll want the subdomains listed first so that it looks there first. If you are using wildcard include files, the name of the file determines the order in which they are loaded. In that case, you'll need to do some filename manipulation to control the order in which the vhost conf files are loaded. i.e. 1_vhost.conf, 2_vhost.conf, etc... – Satalink Aug 14 '14 at 15:51