E
E
Eugene2017-07-13 21:45:24
linux
Eugene, 2017-07-13 21:45:24

Own web server control panel how to communicate with system files?

There was an idea to make my own ISP Manager type panel in PHP,
the essence is to start with a couple of simple things:
Creating virtual hosts in the Apache and Nginx config
Actually stuck at the stage of how to create your own files (configs) in the /etc/ folder... save and edit them if www-data is executing the script - well, that is, it has rights to all the directories above the site .. I wonder how isp does this and tell me where to look at all about working with file servers in PHP scripts

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Michael, 2017-07-14
@programmer403

There are three ways to do this:
1. Create a new virthost data in a neutral location (SQL, MQ, key-val storage or temporary file).
By cron or through a sudo script, start importing this data into a file + subsequent deletion if the import was successful.
2. When installing the panel, make a postinstall script that creates a directory owned by www-data in /etc/nginx/virtualhosts/ - then root is not needed.
3. Don't keep wirthots in this place at all. And keep them in SQL or LDAP.
The latter is generally the most elegant way, because it will allow you to move on to the Zero-configuration approach (you will have beautiful scaling, according to your mind).

A
Alexander Alexandrovich, 2017-07-13
@tatu

Look at the implementation of VestaCP
There, all actions are written in bash, and the web already launches them

S
Sanes, 2017-07-13
@Sanes

It is possible on bash, as Alexander Aleksandrovich advises . Or you can do it like this .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question