hockey97 Posted June 30, 2011 Share Posted June 30, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/ Share on other sites More sharing options...
trq Posted July 1, 2011 Share Posted July 1, 2011 I'm not overly familiar with freeBSD but most Linux distros would have this as a seperate package, maybe freeBSD does the same? Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1237148 Share on other sites More sharing options...
hockey97 Posted July 1, 2011 Author Share Posted July 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1237266 Share on other sites More sharing options...
trq Posted July 1, 2011 Share Posted July 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1237270 Share on other sites More sharing options...
hockey97 Posted July 19, 2011 Author Share Posted July 19, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1244912 Share on other sites More sharing options...
trq Posted July 19, 2011 Share Posted July 19, 2011 Yes, un-comment that include, then read here: http://httpd.apache.org/docs/current/vhosts/mass.html Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1244921 Share on other sites More sharing options...
hockey97 Posted July 19, 2011 Author Share Posted July 19, 2011 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? 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1244931 Share on other sites More sharing options...
trq Posted July 20, 2011 Share Posted July 20, 2011 Just add it anywhere in the file. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1244962 Share on other sites More sharing options...
hockey97 Posted July 20, 2011 Author Share Posted July 20, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1244970 Share on other sites More sharing options...
hockey97 Posted July 20, 2011 Author Share Posted July 20, 2011 ok, got it to work. Thanks. I just had to make an error blank file. all is good right now. Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1245003 Share on other sites More sharing options...
hockey97 Posted July 20, 2011 Author Share Posted July 20, 2011 one, last question about this... if I am using this can I still use the rewrite mod? or will there be a conflict if I use the rewrite mod. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1245308 Share on other sites More sharing options...
hockey97 Posted July 22, 2011 Author Share Posted July 22, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/240827-how-to-setup-mod_vhost_alias-via-apache/#findComment-1246288 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.