Score:0

Failing to enable includes | apache2

de flag

I'm trying to enable includes on a specific URI through Apache2, but I'm getting an error occurred while processing this directive:

enter image description here

My /magic/index.html URI is located at /var/www/html/magic/index.html:

enter image description here

..., the includes folder is at /var/www/html/magic/includes

enter image description here

...and my conf at /etc/apache2/sites-enabled/magic.conf:

enter image description here

foo.html and bar.html just contain a string of text like this is the foo include. I tried surrounding the strings with <p> tags also, but got the same error.

enter image description here

I've tried multiple options for the path on the virtual tag of the HTML files, and moving the includes folder to /var/www/html/, but I always get the same error. I'm open to try any possibility that you guys my suggest though.

Thanks a lot for the help!

EDIT:

When changing the Location to /var/www/html/magic, the includes are not recognized:

enter image description here

1. enter image description here

2. enter image description here

in flag
Your `Location` path is incomplete. `/magic/` is not the same as `/var/www/html/magic`. I’m also not sure what you’re trying to do. Is the goal to have the content of your `includes` directory used as part of a template that gets output with the requested HTML file?
dNyrM avatar
de flag
I changed the `Location` as suggested but the includes are not recognized. I added an edit on the post with the screenshot of what I get. As for what I'm trying to do, it's exactly what you wrote: to get the content of `includes/` on `magic/index.html` (I'm learning how to use apache) @matigo
Score:0
in flag

Looking through the images of your configuration and files, there are a few things you may want to check:

  1. Is mod_includes enabled for Apache?
    sudo a2enmod includes
    
    Note: Be sure to restart/reload Apache afterwards: sudo service apache2 restart
  2. Are the files for inclusion properly readable by Apache?
    sudo chown -R www-data:www-data /var/www/html/magic
    
  3. Have you configured AddType and AddOutputFilter in the virtual host configuration file?
    <Directory /var/www/concept>
        Options +Includes
    
        ...
    
        AddType text/html .html
        AddOutputFilter INCLUDES .html
    </Directory>
    
    Note: Be sure to restart/reload Apache afterwards: sudo service apache2 restart

So long as these three items are correct, you should be good to go. I've tested this on a fresh Ubuntu Server 20.04 VM running Apache 2.4.41.

dNyrM avatar
de flag
Still the same error. I edited my post and added at the bottom two more screenshots referencing your first and second point. As for the third, I was unsure about where `/var/www/concept` came from since I don't have any stanza with that path on my vhost config file, so I tried different approaches: creating a new Directory with those exact params that you wrote and `/var/www/concept`; I have a Directory with a path of `/var/www/` so I tried adding those options there instead, tried also adding them on `Location`...but none of them did the job
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.