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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Dispatcher: Unable to create parent directory error

Mayank_Arora
Level 3
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
sureshr19072451
Correct answer by
Level 3
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

10 Replies
ZygW
Level 2
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.

Mayank_Arora
Level 3
Level 3

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

Kanwaljit
Level 4
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

Jörg_Hoh
Employee
Employee

Hi,

I guess that you have problems with Selinux. Please consult the dispatcher documentation [1] for this.

kind regards,
Jörg

[1] https://docs.adobe.com/docs/en/dispatcher/disp-install.html#Apache%20Web%20Server%20-%20Configure%20...

Naveen_AEM_dev
Level 4
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?

ncansz
Level 2
Level 2

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

sureshr19072451
Correct answer by
Level 3
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

ajayt131015
Level 1
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.

kautuk_sahni
Community Manager
Community Manager
Thank you for sharing your comment with community.