Use SVN to automatically deploy code in Apache
One problem occurs: svn, ftp, ftp, and svn. Is there a way to connect the two? In fact, you do not need the hooks (Hook) function provided by svn to meet your needs.
Svn configuration and settings can be directly found online. Let's talk about how to configure the automatic synchronization function. File post-commit.tmpl of/www/svn/repos/hooks under svn directory
This is the file to be modified, that is, what we need to do when svn has a commit.
1. Set the directory to be updated and check the corresponding directory on the configured homepage.
2. Modify the post-commit.tmpl file cp post-commit.tmpl post-commit
3. Edit the content of the post-commit file. Note that the post-commit file requires apache users to have the execution permission.
4.
Export LANG = zh_CN.UTF-8
REPOS = "$1"
REV = "$2"
WEB_PATH =/www/web/public_html_new/xxx
LOG_PATH =/www/web/log/svn_upload_log
CURDATE = "date"
Echo "code commit at $ CURDATE"> $ LOG_PATH
/Usr/bin/svn update $ WEB_PATH -- username -- password> $ LOG_PATH
Where:
WEB_PATH is the directory of the web page set in apache
LOG_PATH is the log directory.
After the execution is complete, connect to the local computer and submit the svn code online at the same time. Then, the code can be updated in real time.
Note that
You need to set the. svn directory in apache httpd. conf or the files contained in it to prohibit access.
<DirectoryMatch. * \. svn/. *>
Deny From All
</DirectoryMatch>
Install a Web Server on Ubuntu Server 14.04 (Linux + Apache + MySQL + PHP)
Install and configure the PHP environment in Linux (Apache2)
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)
Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind
Apache details: click here
Apache: click here
This article permanently updates the link address: