2

Running XAMP on Win 8 64. New machine.

Have been running XAMPP for a few weeks with work in sub directories hanging off htdocs without any real problems.

Downloaded a currently operational website and to make it work properly (document root addressing etc) wanted to create a simple virtual host setup. I did this once before with very clear, simple instructions without problems. This time found so much conflicting stuff and I cannot restart Apache after an edit of httpd.conf.

I get error message:

1:49:55 PM  [Apache]    Error: Apache shutdown unexpectedly.
1:49:55 PM  [Apache]    This may be due to a blocked port, missing dependencies,
1:49:55 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
1:49:55 PM  [Apache]    Press the Logs button to view error logs and check
1:49:55 PM  [Apache]    the Windows Event Viewer for more clues
1:49:55 PM  [Apache]    If you need more help, copy and post this
1:49:55 PM  [Apache]    entire log window on the forums

I had edited etc in drivers to:

127.0.0.1       ot48
127.0.0.1       sanetext
127.0.0.1       saneText22
127.0.0.1       alohaenergy
127.0.0.1       unify
127.0.0.1       myexample
127.0.0.1       test  etc etc (10 directories)

Reading Apache info and other places edited httpd.conf to add:

Listen 80
NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
DocumentRoot c:/xampp/htdocs/ot48
ServerName ot48.loc
</VirtualHost>

<VirtualHost 127.0.0.1:80>
DocumentRoot c:/xampp/htdocs/sanetext
ServerName sanetext.loc
</VirtualHost>

<VirtualHost 127.0.0.1:80>
DocumentRoot c:/xampp/htdocs/saneText22
ServerName saneText22.loc
</VirtualHost>

<VirtualHost 127.0.0.1:80>
DocumentRoot c:/xampp/htdocs/alohaenergy
ServerName alohaenergy.loc
</VirtualHost>

Grateful for any suggestions

EDIT Should have said that if I remove the edits in httpd.conf Apache starts no problem

1
  • Output of httpd -t? Aug 25, 2015 at 1:22

1 Answer 1

0

You don't really want to use a loopback address for this. Use either an internal or external real address (or use nothing like I'll show you).

Try this Apache config setup:

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName ot48.loc
  ServerAlias ot48.loc *.ot48.loc
  DocumentRoot c:/xampp/htdocs/ot48
</VirtualHost>

..etc..

Also, you can simplify your hosts file by putting everything on one line, as so:

192.168.0.1   ot48.loc sanetext.loc saneText22.loc alohaenergy.loc unify.loc myexample.loc
13
  • Well I tried - still getting same error message. Looked in Include conf/extra/httpd-vhosts.conf looked in there and same format.... Tried 192. all in one line and 127. all in one line and back to multiple entries. At a bit of a loss what to do next.
    – BeNice
    Aug 25, 2015 at 22:19
  • I just noticed that your hosts configuration doesn't include part of the address. This could very well be the problem. I've updated to show what it should probably look like. You can use PING on the command line to verify that these names are resolving correctly in the first place, > PING ot48.loc should return something like: Pinging dev [192.168.1.1] with 32 bytes of data:.... where 192.168.1.1 is your actual IP address.
    – krowe
    Aug 25, 2015 at 22:37
  • Does it make any difference that I am using 127 or 192 - tried both. Ping just got Ping request could not find host ot48.loc. Please check the name and try again. NB Apache NOT running but hosts.txt updated.. Same old error message. BTW I forgot to say a big thanks for trying.
    – BeNice
    Aug 25, 2015 at 22:46
  • A-ha, you aren't editing the right file. It should be C:\Windows\System32\drivers\etc\hosts. This comes from the UNIX world so it DOES NOT have a file extension (you'll find that the default Windows settings make saving a file without an extension much more difficult, so disable hiding them). When this is working, PING will show your correct IP (of the PC you are serving the webpage from).
    – krowe
    Aug 25, 2015 at 22:51
  • 1
    It WAS the simple stuff. Pretty sure it was an extra </VirtualHost>. Cleaned out the httpd.conf file and then loaded up the vhosts file in extra. Couple of vhosts at a time until the fail and noticed the mistake.
    – BeNice
    Aug 26, 2015 at 3:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .