0

Running Apache 2.4.10 on 'Jessy' Debian 8 ..

I'm trying to get ownCloud to run on my Raspberry Pi2 but the Apache part turns out to be a bit of a hurdle. After going through the Apache docs, several online guides, youtube vids I'm utterly confused. So I'm looking for confirmation and answers hoping there's an Apache expert online :)

Okay, so to function ownCloud needs its .htaccess file to be handled and by now I understand I need to set the "AllowOverride" directive (in a sectionblock) to "All" in some config file.

Either "httpd.conf" or -in my case- "apache2.conf" is Apache's main config file (found at /etc/apache2/). Right ?
And there's also a possibility of a separate config file just for the ownCloud website ? A vhost config file ? How do I go about creating such a vhost file (name? location?) ?
Guides point to the '/etc/apache2/sites-enabled' location and that I should edit "000-default.conf" but that's not a file .. it's a symbolic link to a corresponding file at '/etc/apache2/sites-available'. Do I understand it right that I should put -let's say- vhost code sections in that one file ?

Now the actual questions:
- at what level should I enable htaccess, at the main config or in a vhost config ? trying to keep security as tight as possible ..
- does anyone know if altering the AllowOverride directive the only thing is what needs to be done ? A rewrite module is also often mentioned. How about that ?

I'm gonna go with davidgo's suggestion to use the AllowOverride specifically in the virtual host file for owncloud. And I get the rather elegant logic of defining a vhost in sites-available and then 'enabling' it by putting a sym.link in sites-enabled. Thank you Paul for pointing that out to me.

Thanks in advance for your time and effort !

2
  • Guys, I think I made a thinking error. Everywhere I look I see: you need virtual hosts when running multiple websites on 1 machine. But correct me if I'm wrong, shouldn't it say: when running multiple websites with different domainnames on 1 machine ?? That would mean that I don't need to create a virtual host; I only got one domainname (and addressing it using my public IP address ..). Then remains the question, can I use a ''Directory /var/www/owncloud'' block, in the main apache2.conf file, to specify the AllowOverride All there ?
    – Supr
    Feb 4, 2016 at 23:29
  • Tested it, placed the block near the other Directory-blocks in apache2.conf, rebooted and using a .htaccess with "blabla" in it, confirmed that .htaccess was being handled (got an error that didn't show up when I used the original .htaccess).
    – Supr
    Feb 5, 2016 at 23:32

2 Answers 2

0

It is possible to have a seperate config file for just the ownCloud website - Apache will read any files which have been added in the main config using the "Include" directive - which typically will cover all files with a ".load" or ".conf"

Enable .htaccess in the Directory container in the appropriate vhost container for better security then having it for all hosts - for even better security, cut and paste the .htaccess contents into the vhost container and do away with the .htaccess file altogether.

In order for the rewrite module to work, the Rewrite directive needs to be turned on. Chances are that your .htaccess file will do this.

The rewrite module is used to rewrite the format of requests, which, for example, allows the URL to hide the fact it is actually executing a php file.

3
  • Is it possible to 'nest' containers? like <Virtualhost ..> ... <Directory ...> ... </Directory ..> ... </Virtualhost ..> or are they supposed to be defined one after another ?
    – Supr
    Feb 4, 2016 at 11:16
  • So I'm guessing I could make a .conf file (with any name ?) but this will end up as code in a main config file anyways, right ?
    – Supr
    Feb 4, 2016 at 11:21
  • You can nest Directory containers in vhosts. The conf file can have any name, but needs a .conf extension. Im pretty sure files are ordered, hence the number at the beginning.
    – davidgo
    Feb 4, 2016 at 17:35
0

If you are just using Apache for owncloud, then you can AllowOverride globally.

Frankly, in most cases, you'd want this enabled for all sites anyway, as using .htaccess for friendly urls is very common.

Yes, the correct place to put this for global enablement is in 000-default.conf. Yes, this is "just a symbolic link" but that is just the way Debian manage sites. The actual configuration files for each site are stored in /sites-available and the a2ensite and a2dissite commands are used to enable and disable sites by adding the symbolic links to /sites-enabled. Editing the symbolic link is the same as editing the real file.

You'll see at the end of your apache2.conf there is an include to pull in any conf files from /sites-enabled

Add the statement inside the <VirtualHost *:80> section, which will match any site (that isn't otherwise defined in its own config file).

Yes, there is the possibility of having a config file for owncloud alone, in which case, you would create a new config file in /sites-available (perhaps by copying 000-default), adding a ServerName directive to match the URL that you'll use to access owncloud, then enabling it with a2ensite <config file name>.

1
  • Okay I will copy the 000-default.conf file and alter it to define the ownCloud 'website', add the AllowOverride directive, and then run the a2ensite command. I will give this a try! I'll let you guys know if it worked.
    – Supr
    Feb 4, 2016 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .