Python Network Programming
by Abhishek Ratan, Eric Chou, Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker
How it works...
This recipe sets up the initial Apache configuration parameters as constants and then defines two functions. In the remote_server() function, the usual Fabric environment parameters, for example, hosts, user, password, and so on, are placed.
The setup_vhost() function executes a series of privileged commands. First, it checks whether the website's document root path is already created using the exists() function. If it exists, it removes that path and creates it in the next step. Using chown, it ensures that the path is owned by the current user.
In the next step, it uploads a bare bone HTML file, index.html, to the document root path. After uploading the file, it reverts the permission of the files to the web server user. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access