logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache not working / subdomains problem
Author
ranger



Joined: 01 Nov 2011
Posts: 11

PostPosted: Tue 01 Nov '11 15:10    Post subject: Apache not working / subdomains problem Reply with quote

I have a couple of websites, each in its own directory on my D drive. I want to make a subdomain for each site.

I modified httpd.conf accordingly, but now Apache doesn't start anymore.

The error message (OS 10048) is: "only one usage of each socket address is permitted" "make_sock: could not bind to address 0.0.0.0.0:80 no listening sockets available"

OS is Windows, I edited httpd.conf so that in includes now the following lines:

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
Listen 80
ServerName localhost
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "D:/sites/site1/"
ServerName site1.localhost
DirectoryIndex index.php index.html index.htm

<Directory "D:/sites/site1/">
Options Indexes Includes FollowSymLinks
AllowOverride None
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>


<VirtualHost *:80>
DocumentRoot "D:/sites/site2/"
ServerName site2.localhost
DirectoryIndex index.php index.html index.htm

<Directory "D:/sites/site2/">
Options Indexes Includes FollowSymLinks
AllowOverride None
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>



I added the subdomains in the HOST file in System32, which now contains:
127.0.0.1 localhost
127.0.0.1 site1.localhost
127.0.0.1 site2.localhost



I don't understand why the server doesn't start in the first place...
Any clues?
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3093
Location: Hilversum, NL, EU

PostPosted: Tue 01 Nov '11 18:03    Post subject: Reply with quote

Looks like an instance of httpd.exe is still running. You can stop it in task manager.

Steffen
Back to top
ranger



Joined: 01 Nov 2011
Posts: 11

PostPosted: Wed 02 Nov '11 11:31    Post subject: Reply with quote

Thanks a lot!
Yes, now it's OK, except for one detail:
when I go to http://localhost in the browser, I am automatically redirected to "site1", which should be just a subdomain (site1.localhost).

I thought the default localhost would remain the same- C:/.../Apache2.2/htdocs

Do you know why this happens? Actually I would like to move the default root to D:/ApacheDocs directory.
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 685

PostPosted: Wed 02 Nov '11 11:48    Post subject: Reply with quote

The first Virtual host is the default. Since you do not have a servername localhost is going to that one.


Make an extra virtual host as first one:

<VirtualHost *:80>
ServerName localhost
ServerAlias 127.0.0.1
ServerAlias your extranal IP for instance
DocumentRoot C:/.../Apache2.2/htdocs
</VirtualHost>


Steffen
Back to top
ranger



Joined: 01 Nov 2011
Posts: 11

PostPosted: Wed 02 Nov '11 12:35    Post subject: Reply with quote

Now it's OK, great advice!

Thanks!
Back to top


Reply to topic   Topic: Apache not working / subdomains problem View previous topic :: View next topic
Post new topic   Forum Index -> Apache