Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Been at the for a few days and figure it's high time I get a bit more experienced advice.

I'm working to package a perl application - all of which's files should be placed in the /var/www/<packagename> directory on the system.

So far I've been able to build the package - but it's not placing my files in this directory and I haven't read any concise ways on how to do so.

Right now my package builds properly - apart from lintian warnings but they are mainly that i'm using the template files from dh_make, which i'll update once i get this to work properly.

Essentially right now I have this as my structure:


 - debian directory with control/copyright/rules/ ...
 - directory belonings to app
 - directory belonging to app
 - files belonging to app

I've been building with

dpkg-buildpackage -us -uc

(Not signing for now, will do so once properly built) and doing this from the package directory. And this outputs my .deb, .changes , .orig.tar.gz , and .dsc

Any help would be appreciated. Again - the main issue that i'm having here is that I want to put the app files/directories into /var/www/<packagename>upon installation.

share|improve this question
"all of which's files should be placed in the /var/www/<packagename> directory on the system" Are you sure it wouldn't be better to put it under /usr/share/<packagename> and then provide a HTTPd configuration file using Alias or ScriptAlias? – Ignacio Vazquez-Abrams Jul 5 '12 at 18:56
I can check. I didn't write the app - someone else on my team did and when he showed me the configuration he said to place it in the /var/www/<packagename> folder. Right now… helped a lot to answer my question and I think I answered this and I'll come back and elaborate if it does. But right now it's lunch time :) – TJ Biddle Jul 5 '12 at 19:03
Are you trying to build a package for internal use only, or are you planning on distributing this to the public? – Zoredache Jul 5 '12 at 20:00
@Zoredache - Internal use only. So far it looks like my previous comment solved everything I needed. overprescribed brought up some good points as well which I actually just ran across a few minutes ago, but I'm not too worried about as this is internal. I have a section in my wiki for this info and have being lintian compliant a part of that - and lintian gives errors about /var/www as well. – TJ Biddle Jul 5 '12 at 23:38

Debian packages should not install files under /var/www. This is not one of the /var directories in the File Hierarchy Standard and is under the control of the local administrator. Packages should not assume that it is the document root for a web server; it is very common for users to change the default document root and packages should not assume that users will keep any particular setting.

Packages that want to make files available via an installed web server should instead put instructions for the local administrator in a README.Debian file and ideally include configuration fragments for common web servers such as Apache.

phpldapadmin - a popular php based ldap administration tool - comes with a file to be included in /etc/apache2/conf.d/ with two options:

# Option 1: Define /phpldapadmin alias, this is the default
<IfModule mod_alias.c>
    Alias /phpldapadmin /usr/share/phpldapadmin/htdocs

# OR Option 2: You can also use phpLDAPadmin as a VirtualHost
<VirtualHost *:*>
 DocumentRoot /usr/share/phpldapadmin/htdocs
 ErrorLog logs/
 CustomLog logs/ common

#Then define the directory options like default index, access control etc.
<Directory /usr/share/phpldapadmin/htdocs/>
 DirectoryIndex ...

Following this example, you'd install the files you want to show in /var/www/yourpackage in /usr/share/yourpackage/htdocs and edit your included apache conf accordingly. Then save the included apache conf snippet in /usr/share/doc/yourpackage/examples/ or install it straight to /etc with the package. Add instructions in README.Debian (in the same doc directory) to have users link /etc/yourapp.conf or /etc/yourapp/apache.conf to /etc/apache2/conf.d/yourapp.conf and restart Apache.

share|improve this answer
If he is building a package for internal use only, then he is the local administrator. If he wants to build a package to deploy files to /var/www that is certainly something he is permitted to do, and even somewhat common. – Zoredache Jul 5 '12 at 20:02
I upvoted this comment as it has relevant material but didn't particularly answer my questions so I'm not selecting it as the accepted answer. Thank you for the detailed information though! – TJ Biddle Jul 5 '12 at 23:39

I ended up using the information found in this: SO question. While this is not the proper way to place files in the /var/www file if your package is to be used for external use - this works for me as it is an internally used package.

Please see overprescribed's comment regarding this as it does have very detailed information, it just wasn't accepted as it didn't answer the actual question and just said that I shouldn't do that and a way around it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.