linux - PHP application to replicate websites from single code source -
I am trying to create an application in PHP to help configure new websites.
New sites will always be based on a specific "codebase", which includes all the necessary web files. I want my PHP scripts to copy those web files from one domain's webspace to another domain's webspace. When I click on a button, an empty webspace is populated with files from another domain, both domains are on the same Linux / Apache server.
As an experiment, I tried to use shell and exec commands in PHP to perform actions in the form of "root". (I know it can open the main security hole, so this is not my ideal method.) But I had similar permissions problems and that method could not work too.
But I'm running into permissions while dominating the domain / ownership issues may be that a CGI script is a better idea, but I'm not sure how to contact it.
Any advice is appreciated. Or, if you know about a better resource for this type of information, please point me to it. I am sure that such a "website setup" application has been created earlier.
Thank you!
The only difference I am doing this is that I am not making copies of core files . The system has a core and only specific files are copied.
If you want to copy files, then you have to consider the following:
-
One easy (less secure way) for the same user for all websites Otherwise (if you want to provide different access) - You have to create a separate owner for each website. You must set owner / group for copied files (this will be done by root).
-
For the new website setup: either the main domain will run as root, and then it will be able to execute a new website creation, or if you use your main domain If you do not want to root, you can do the following: Create a chronose (or PHP script running in a loop under CHI), which will be implemented root. This will examine some database records for every 2 minutes, for example, and you can add a record with the setup information for your newly hosted website from the main domain (or you can execute some scripts using the benefit And not without cron).
-
The script that makes this can be done in php. It can be done in any of your languages, it does not really matter until it gets right access.
In my case I'm using the same user because they are all my websites. The disadvantage is that the OS will not create restrictions, my php code (I am between different websites Losing the advantage of user / group permissions).
Notice that Open_Baseer can cause you problems, make sure you get the correct path out (or disabled).
Also, there is some minor difference between fastCGI and suPHP (I believe it will not bother you too much).
Comments
Post a Comment