Jump to content
The Uniform Server Community

Multiple Sites Directed to Folder Listing


Jason H.
 Share

Recommended Posts

Preface: My sincere apologies if this question of mine has already been answered on the board. I've been browsing misc articles both here and on Apache's site but have been unable to find an answer.

 

I've been attempting to setup multiple sites on Uniform Server. At first, I was unable to access the site on different PCs (turns out the Firewall was on, go figure) but now I can. Unfortunately, the "new" site I've enabled in httpd.conf (or through the aPanel interface) is directing me to the /www/ root.

 

At first, I kept seeing the "Welcome to Uniform Server" index.php page when I typed in my new domain. Then, I deleted that file as well as the "images" and "css" folders that resided in that /www/ directory. So, all that remained was my new site folder (/site1/) and the .htaccess file.

 

Now, when I try to access my new domain in the browser, I only see a listing of one folder. When I click on the respective folder, I get the correct site contents but they essentially reside in a subdirectory: www.site1.com/site1.

 

How can I get site1.com to look directly at that /site1/ folder instead of having to choose from a list of folders? I've already specified the directory location in the httpd.conf file.

 

<VirtualHost *>
ServerName localhost:80
DocumentRoot C:/Users/Administrator/Desktop/www2/www
</VirtualHost>

<VirtualHost *>
ServerName *.site1.com
DocumentRoot C:/Users/Administrator/Desktop/www2/www/site1
ErrorLog logs/site1_error.log
CustomLog logs/site1_custom.log combine
</VirtualHost>

 

Many thanks for help. Again, I've combed through dozens of postings both here and on the wiki as well as on Apache's site. I have to be missing something obvious. :)

Link to comment
Share on other sites

Do you really read ;-)

 

Not long before did Ric just recommend the great informative page here, as well as the long talk about this here, also referred by the short one here ...

 

Besides, for your own situation, you may either have a default page that can automatically redirect to your target folder, without touching anything else ...

 

Good luck ;-)

 

 

Preface: My sincere apologies if this question of mine has already been answered on the board. I've been browsing misc articles both here and on Apache's site but have been unable to find an answer.

 

I've been attempting to setup multiple sites on Uniform Server. At first, I was unable to access the site on different PCs (turns out the Firewall was on, go figure) but now I can. Unfortunately, the "new" site I've enabled in httpd.conf (or through the aPanel interface) is directing me to the /www/ root.

 

At first, I kept seeing the "Welcome to Uniform Server" index.php page when I typed in my new domain. Then, I deleted that file as well as the "images" and "css" folders that resided in that /www/ directory. So, all that remained was my new site folder (/site1/) and the .htaccess file.

 

Now, when I try to access my new domain in the browser, I only see a listing of one folder. When I click on the respective folder, I get the correct site contents but they essentially reside in a subdirectory: www.site1.com/site1.

 

How can I get site1.com to look directly at that /site1/ folder instead of having to choose from a list of folders? I've already specified the directory location in the httpd.conf file.

 

<VirtualHost *>
ServerName localhost:80
DocumentRoot C:/Users/Administrator/Desktop/www2/www
</VirtualHost>

<VirtualHost *>
ServerName *.site1.com
DocumentRoot C:/Users/Administrator/Desktop/www2/www/site1
ErrorLog logs/site1_error.log
CustomLog logs/site1_custom.log combine
</VirtualHost>

 

Many thanks for help. Again, I've combed through dozens of postings both here and on the wiki as well as on Apache's site. I have to be missing something obvious. :)

Link to comment
Share on other sites

I actually did read. I had been repeatedly reading every post re: VirtualHost (including the ones to which you linked) for 6+ hours. I'm obviously missing something but I'm not sure what that is. Perhaps I just needed some sleep. I'll review all of the pages I've already reviewed and see if I can't get anywhere.

 

Thx for the response though. I appreciate you linking to those pages.

 

BTW, the redirect won't work b/c I'll have multiple sites (as soon as I can get this working) AND I don't want my site to reside in a subdirectory (e.g., site1.com/site1).

 

Do you really read ;-)

 

Not long before did Ric just recommend the great informative page here, as well as the long talk about this here, also referred by the short one here ...

 

Besides, for your own situation, you may either have a default page that can automatically redirect to your target folder, without touching anything else ...

 

Good luck ;-)

Link to comment
Share on other sites

While I don't have "THE" answer, I suggest you look at some of the Apache.org docs (Google: Apache 2.2 virtual host) to help. I'll be checking this out later today as well.

Also be sure to look at the log files for clues.

 

When I was setting up a Linux site a year ago, I recall that we also had to adjust the DNS entries for the host. Have you investigated that? Unfortunately, I don't currently have access to the configs for that site, which would probably resolve the question. :)

Good luck,

BobS

Link to comment
Share on other sites

In your example this is the default. Any site/s Apache cannot resolve will be directed to this.

<VirtualHost *>
ServerName localhost:80
DocumentRoot C:/Users/Administrator/Desktop/www2/www
</VirtualHost>

There is no need to change the above default.

 

Apache cannot resolve this site:

<VirtualHost *>
ServerName *.site1.com
DocumentRoot C:/Users/Administrator/Desktop/www2/www/site1
ErrorLog logs/site1_error.log
CustomLog logs/site1_custom.log combine
</VirtualHost>

You cannot use wildcards in the SererName hence *.site1.com is incorrect use site1.com

 

If you ant to use wild cards include a ServerAlias directive

 

<VirtualHost *>
ServerName site1.com
ServerAlias site1.com *.site1.com

DocumentRoot C:/Users/Administrator/Desktop/www2/www/site1
ErrorLog logs/site1_error.log
CustomLog logs/site1_custom.log combine
</VirtualHost>

 

All the best

Ric :)

Link to comment
Share on other sites

Ric,

 

I've made the "server alias" change that you mention above but that still doesn't make a difference - either by hitting site1.com or www.site1.com in my browser. I still get the "Index of /" folder listing page.

 

I feel like I'm in a rut. There's no other changes, in the dozens and dozens of documents I've reviewed, that I think I need to make.

 

Anyway, I sincerely appreciate you posting a reply.

 

In your example this is the default. Any site/s Apache cannot resolve will be directed to this.

<VirtualHost *>
ServerName localhost:80
DocumentRoot C:/Users/Administrator/Desktop/www2/www
</VirtualHost>

There is no need to change the above default.

 

Apache cannot resolve this site:

<VirtualHost *>
ServerName *.site1.com
DocumentRoot C:/Users/Administrator/Desktop/www2/www/site1
ErrorLog logs/site1_error.log
CustomLog logs/site1_custom.log combine
</VirtualHost>

You cannot use wildcards in the SererName hence *.site1.com is incorrect use site1.com

 

If you ant to use wild cards include a ServerAlias directive

 

<VirtualHost *>
ServerName site1.com
ServerAlias site1.com *.site1.com

DocumentRoot C:/Users/Administrator/Desktop/www2/www/site1
ErrorLog logs/site1_error.log
CustomLog logs/site1_custom.log combine
</VirtualHost>

 

All the best

Ric :)

Link to comment
Share on other sites

Ok do you have an entry in your hosts file?

 

http://wiki.uniformserver.com/index.php/Vi...ing:_Name_based

 

Location of hosts file

 

http://wiki.uniformserver.com/index.php/Ne...#Hosts_Location

 

All the best

Ric :)

Link to comment
Share on other sites

The apanel had already modified my hosts file for me but I have tried to change a few things within it manually - to no avail.

 

However, this "hosts" file is just useful for local resolution, correct? Either way, I'm getting the same result when I try to access my domain either within the server (where the hosts file resides) or outside the server on another computer: an "index of /" folder listing.

 

Thanks again. If you think of anything else, I'd be greatly appreciative.

 

Ok do you have an entry in your hosts file?

 

http://wiki.uniformserver.com/index.php/Vi...ing:_Name_based

 

Location of hosts file

 

http://wiki.uniformserver.com/index.php/Ne...#Hosts_Location

 

All the best

Ric :)

Link to comment
Share on other sites

Who told you that "the redirect won't work b/c I'll have multiple sites" ;-)

 

Remember you are playing with dynamic script like PHP, based upon what the client requests, it is common to redirect or even to proper language set etc ...

 

In my opinion, I would rather "want my site to reside in a subdirectory" (or even further, outside US tree), since it is trivial to switch between alpha and beta without client notice ;-)

 

...

 

BTW, the redirect won't work b/c I'll have multiple sites (as soon as I can get this working) AND I don't want my site to reside in a subdirectory (e.g., site1.com/site1).

Link to comment
Share on other sites

Well, as what Ric told us, Apache services the dir with first hit, so you may investigate your logs according to what your conf states. It is the easiest way to find if the name based conf works as expected, either pay attention to the timestamp or clear the logs before a test. This is the first step to discriminate multiple '<VirtualHost ... >' directives, especially the way you arrange them ;-)

 

For the '"index of /" folder listing' may indicate wrong dir serviced, you may re-arrange that conf once you are sure of the named based ok ...

 

The apanel had already modified my hosts file for me but I have tried to change a few things within it manually - to no avail.

 

However, this "hosts" file is just useful for local resolution, correct? Either way, I'm getting the same result when I try to access my domain either within the server (where the hosts file resides) or outside the server on another computer: an "index of /" folder listing.

 

Thanks again. If you think of anything else, I'd be greatly appreciative.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...