apache and PHP issue..

Hi, I have my apache server setup to do virtual hosting. I need to be able to host multiple websites on my server. I currently hosting just 2. However, do plan to expand to 40 websites. I am going to start to provide web hosting services. My websites are coded in PHP. I plan to use PHP and javascript to build a website builder right on my website.

However, I am just starting to code the whole thing. I have the check out process done where you place an order for the domain name. The problem is that after all that I need to create a folder in the folder called websites. The folder will be the name of the domain name. However, since the client can buy more then 1 domain name at a time. I will need to loop through making folders for each domain name bought. Each folder will have the proper permissions set. I don't have an issue doing this. I know how to do this in php.

The problem comes when dealing with apache. I don't know exactly what I need to do to setup apache to recognize the new website. I know there is a website-enabled type folder. I know in there I have my 2 websites config files located there. I have no problem creating the file with the proper config for the website itself. However, I recall from setting up those 2 websites that I already setup that some type of commands is needed to be run on apache on FreeBSD in order for the apache to be setup properly to start hosting that new website.

So, I need to know what is needed for apache to recognized this new website? Do I just need to create a file with the website config/settings and just save that file in the folder called websites-enabled inside the apache 2 folder? Or do I need to do more then just create that file? If so then what else is there needed to create another virtual hosted domain name / website?
 
If the configuration files are included in httpd.conf properly, then your new websites will be visible to apache as well. Of course, you need to restart apache for this to work.

Generally, I'd consider it a security risk to allow a web application modify system configuration data, but then again, this is just me...
 
mamalos said:
If the configuration files are included in httpd.conf properly, then your new websites will be visible to apache as well. Of course, you need to restart apache for this to work.

Generally, I'd consider it a security risk to allow a web application modify system configuration data, but then again, this is just me...

Never mind just figured out how I setup my apache server.

I just need to create those individual files. I setup virtual host to look at a base directory and in that directory grab the folder with the domain name given to apache.

So, If you typed in domain1.com and domian2.com and domain1.net

pretty much apache will grab those domain names and then look up the config files in a given folder.

that folder stores all website config files. This avoids having to restart the apache server to enable the new website. It will enable the website once the file is created in that folder.

That folder is inside the apache22 folder. So, all I have to do is pretty much just make the websites config file and if after a long time if at some point I no longer will host that website. I just delete that config file for the website. Then apache no longer will host the website.

I think it's pretty safe. I am not allowing clients or user inputs. So my code will only make these configs after they made the payment for the domain and hosting services.

I don't see it a security risk unless you allow users input and you don't filter that input. I mean you need to prevent them from writing working code.

They won't get access to the Apache config files. I just be creating the website individual file. I will be able to create it and delete it. However, it be only my scripts that be doing it.

I would have agreed with you if I had let users input data to my code or script that will run the code to create these files.
 
Back
Top