Setting up Apache and Subversion on Debian Wheezy¶
This post is archived. It is left as is and won't receive updates.
In this post I describe how to set up Apache and Subversion on a Debian server. It is assumed that Apache is already installed and running properly on your server. This includes PHP if you want to use WebSVN.
Install Subversion¶
Create a folder for your repositories, create a repository and change the owner to the user running Apache
Edit /etc/apache2/mods-available/dav_svn.conf
and add this
<Location /svn>
DAV svn
SVNParentPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /home/svn/passwd
AuthzSVNAccessFile /home/svn/authz
Require valid-user
SSLRequireSSL
</Location>
Activate SSL and the DAV modules on Apache
Now you need the authz
and passwd
file.
The passwd
file can be created using htpasswd
You will then be asked to enter the password for this user.
For authz
you can get a sample file from your repository (conf/authz
).
Copy it to the parent repository location.
To enable your user for the previously created repository add this
This will give your user read and write permissions for this repository.
Now you can use it through this URL https://example.com/svn/yourrepository
.
Add an SSL certificate¶
Create a certificate for your site using Let's Encrypt. If you just want to test this locally, you can also create a self-signed certificate.
Create a self-signed certificate
You don't have to enter information when you get asked but some might be helpful. It will be valid for 365 days. Your browser will tell you that there is a problem with this certificate (since it's not issued by a trusted certificate authority).
Add the certificate files to /etc/apache2/ssl
(create this directory first).
Create a file for your site in /etc/apache2/sites-available/
<VirtualHost *:443>
ServerAdmin admin@server.name
ServerName your.server.name
DocumentRoot /var/www/yourSiteSSL
<Directory /var/www/yourSiteSSL>
Options -Indexes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error_ssl.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
</VirtualHost>
Enable your SSL site and restart the server
Optional: Install WebSVN¶
After, the configuration dialog appears.
- Select Apache2 (deselect the others using space)
- Type in the location of the folder with your svn repositories
To make SSL a requirement for WebSVN edit /etc/websvn/apache.conf
and uncomment SSLRequireSSL
.
And to restrict access only to authenticated users add this:
You may notice that the authz
line is missing.
This has to be done in the websvn
config file located in /etc/websvn/config.php
.
Uncomment this line and add the path to the auth file
Optional: Don't show the complete server token for Apache¶
In /etc/apache2/conf.d/security
change the line
to
Comments
Comments are currently not supported. For the time being, please send me an email.