Jump to content

Recommended Posts

Hi, I want to setup and use mod_vhost_alias to be able to make folders in a www folder so that those folder inside that www folder would create websites or auto config. the folder name would be the name of the domain name.

 

I have no clue where to start and how to do this. I have a main config file where the main server config is at. Then I got a offline config file and a online website config file these files have the virtual host code / config and currently has configs in them for my 2 website.

 

I am planning to start a hosting company. So need to setup apache in a  way that I can host many websites.

 

I plan to use php to automate things as I can. So I be making the websites folder once I get paid from the client.

 

So I would like to know how to set this up.

 

I am using freebsd 8.1 and apache 2.2.  Is there any good tutorials. I have looked at the apache docs.

 

which is located here:

http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html

 

but it's not specific  only talks about what line of code you need to add to config it. Dosen't talk about how to install it or enable it on apache and the dosen't  tell exactly where to make the changes... well says to make the changes to httpd.conf  but I don't have that file. I think mines is something like apache2.conf  and I have offline and online site.conf .

 

So I need to know if the code or the changes to the config would be inside the main config file  or would it be where the websites config file is at.

 

:confused::shrug:

Link to comment
https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/
Share on other sites

ya, but I think it's already installed. If I use that php info function. It shows in the apache section that it has that as modules loaded. I can see it in the list.

 

So I assume it's installed.  I did ask at the freebsd website forum. Yet, I haven't got a solid answer. Just had a reply to look at the freebsd documentation of apache... which wasn't any help. Since they only show how to load a modular and only should how to load the php module in apache. it won't help since I won't know what name this mod would be named. I do know the file name but don't know the name of it's loading name.

 

For example this was how php5 is loaded in apache:

 

LoadModule php5_module        libexec/apache/libphp5.so

 

you can see it says php5_module  I am not sure if I should  do this  LoadModule  modulename_module    path to module file.

 

That's just my guess but don't know if that is what I need to do.

That is indeed what you need to do. Your modules directory should be listed in Apache main config file (generally httpd.conf). You may also see the modules them selves being loaded in this same file, or you config might br broken up into multiple files. Either way, digging through your httpd.conf file should get you a pretty good start.

  • 3 weeks later...

hey there is a file config that I can uncomment:

it's: # Virtual hosts

#Include etc/apache22/extra/httpd-vhosts.conf

 

do I make the changes and setup via that file? I notice it has some example code.

 

but the examples lack what I want to do. I want to make just one virtual host config and have it where the path to the file the folder name itself will have to match the same as the website name request first.

 

are there any good examples that show how to make one config setup where the document root changes based on what website domain name it needs to respond too???

 

that way I can just add new folders on my server and it would automatically be config and all set to go.

ya, I read that but I am totally confused.

 

it shows this:

 

# get the server name from the Host: header

UseCanonicalName Off

 

# this log format can be split per-virtual-host based on the first field

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

CustomLog logs/access_log vcommon

 

# include the server name in the filenames used to satisfy requests

VirtualDocumentRoot /www/hosts/%0/docs

VirtualScriptAlias /www/hosts/%0/cgi-bin

 

I understand what they do just don't know exactly where to put it in that new extra file?  :confused:

 

that documentation dosen't exactly explain how you would add such code in the file. Just explains what it does which I understand what it does.

 

 

Just add it anywhere in the file.

 

ok, so just add that and then restart apache?

 

also can you explain to me what exactly the custom log path is?

 

the config is:

 

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

CustomLog logs/access_log vcommon

 

 

I  am looking at the apache manual part of custom logging.

 

located here:

 

http://httpd.apache.org/docs/2.0/mod/mod_log_config.html

 

they focus more on explaining the format.

 

however I don't understand where the default custom log will be via root server path.

 

like I don't know  what this path means  logs/access_log  don't know if it's like www.mydomain.com/logs/access_log

 

or does it mean /home/logs/access_log  or is it referring with the default root of where the apache files been stored.

 

the documentation dosen't explain this. It just explains  how to format the custom log.

Hi, I got the thing to work but notice some things about my website that no dosen't work. I notice some scripts are outside the web server access folder... so I use a direct data path to the file. This no no longer works.

 

I used in php the include  function to include this file. Yet,  now it's failing saying that the file is missing.

 

do you think in my php file I am not using the code proper or is this something I have to fix  on the apache side?

 

I think I should be using  include_path instead of include. Not too sure. I willl play around and see what happens but in the meantime would like some response on what you guys may thing could cause the problem.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.