Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Dispatcher: Unable to create parent directory error

Avatar

Level 3

Hello,

I went through the available AEM documentation to configure a dispatcher. I was able to do so and mask my publisher behind a dispatcher. Rendering is working fine but the content is not getting cached and I get the below error in my dispatcher log.

I did the following steps at my end:

1. Defined a custom <docroot> location and did a 'chown' on it to change the owner to my custom user.

2. I start my apache (where disp is configured) as 'sudo service httpd start'. Since it's the sudo user, I assume it should be able to replicate the /content/..../... dir structure on the specified docroot location as is on the defined render/publisher. But I get the 'Unable to create parent directory <docroot>/content/abc: Permission denied' error and cache is not getting created.

3. Did a chmod 777 on <docroot> - just to test if it fixed the error but it did not.

Please advice.

cachefile does not exist or is a directory: <docroot>/content/abc/home.html
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] try to create new cachefile: <docroot>/content/abc/home.html
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] cache-action for [/content/abc/home.html]: CREATE
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] connected to render rend01 (<render IP>)
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: Host
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: Cache-Control
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: Accept
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: User-Agent
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: Accept-Encoding
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: Accept-Language
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Spooling request header: Cookie
[Thu Jan 02 03:44:28 2014] [D] [18861(139751847729184)] Detected: chunked transfer encoding
[Thu Jan 02 03:44:28 2014] [E] [18861(139751847729184)] Unable to create parent directory <docroot>/content/abc: Permission denied

1 Accepted Solution

Avatar

Correct answer by
Level 3

It maybe helpful for those trying to figure this out on RHEL + Apache 2.4.6

Try this SELinux Prevents httpd Write Files - Unix & Linux Stack Exchange

Worked for me. The commands you have to run after making sure rw permissions are given for apache user on <docroot>

semanage fcontext -a -t httpd_modules_t /etc/httpd/modules/mod_dispatcher.so

setsebool -P httpd_can_network_connect on

chcon -R -t httpd_sys_rw_content_t /var/www/html/

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html(/.*)?"

restorecon -Rv /var/www/html

Restart apache -

View solution in original post

0 Replies

Avatar

Level 2

apache runs as the user configured in httpd.conf in the user directive, and by default is 'apache'.   It starts as root to bind to port 80/443 and immediately switches to the user defined in httpd.conf.  What user do you have apache running as? Make sure the <docroot> is writable by the user apache is running as (having it owned by that user is a good idea) and restart apache.

Avatar

Level 3

I did a 'sudo chown -R apache .' on the <docroot> and restarted apache - it worked. Thank you ZygW.

Avatar

Level 4

ZygW / Mayank,

Is this OS specific within linux  ? I am on CentOS 7.0 Having tried all these options, I am still getting the same error

ERROR : [Sun Mar 08 19:28:07 2015] [E] [59848(140308474173504)] Unable to create parent directory /aem/dispatcher/docroot/etc/clientlibs: Permission denied

I have changed the user/group in httpd.conf which is used to start the apache instance. Still same issue...

I tried giving 777 permissions to the folders but didn't help

s/w used :  apache 2.4, Centos 7 , 64 bit

any thoughts ?

/KS

Avatar

Level 4

I've got this exact same issue and I tried both suggestions mentioned here - changing the doc root ownership to apache user and also following the steps for SELinux from the docs but the issue still remains.

Thoughts?

Avatar

Level 2

Have You been able to resolve the problem when none of the suggestion mentioned here work ??

Avatar

Correct answer by
Level 3

It maybe helpful for those trying to figure this out on RHEL + Apache 2.4.6

Try this SELinux Prevents httpd Write Files - Unix & Linux Stack Exchange

Worked for me. The commands you have to run after making sure rw permissions are given for apache user on <docroot>

semanage fcontext -a -t httpd_modules_t /etc/httpd/modules/mod_dispatcher.so

setsebool -P httpd_can_network_connect on

chcon -R -t httpd_sys_rw_content_t /var/www/html/

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html(/.*)?"

restorecon -Rv /var/www/html

Restart apache -

Avatar

Level 1

It's clear from the mentioned logs dispatcher tried to create the cache, but was unable to create cache files or directory.   

cache-action for [/content/abc/home.html]: CREATE

Unable to create parent directory <docroot>/content/abc: Permission denied

Reason

Configured apache user does not have write access over docroot cache folder.

Solve

To identify the apache user open httpd.conf and search for "User _www". Usually it is present inside <IfModule unixd_module> section. Here _www is user name and cache directory can be checked under /cache section of dispatcher.any. Check /docroot property like /docroot "/usr/local/var/www".

Assign write permission to "_www" user over directory "/usr/local/var/www".

 

Step 1 : Set the ownership of your desired directory/file to the _www user

sudo chown -R _www:staff /usr/local/var/www

Step 2 : Set the permissions so that the _www can write in the directory/file without giving permissions to everyone else:

sudo chmod -R 755 /usr/local/var/www

 

Restart apache. Load the page again and check cache folder for cached content.