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

Host static site in dispatcher

Avatar

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile
msina
Level 3

23-04-2019

Hi ,

Recently we got requirement to host a site in our AEM environment.The site will be always static with few image ,css and js .

We got the html file along with the other required contents (images, css, js fonts etc).

We are planning to create a directory inside "/opt/communique/dispatcher/cache/content" called "newsite"

/opt/communique/dispatcher/cache/content/newsite ,so that it serves from the dispatcher cache always.

Any idea how can we achieve this.When i hit the newsite.html it does not load the images .

Also is there any other easy way to host this static site in AEM dispatcher.

regards

Sina

Replies

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

23-04-2019

Have you already built a site in AEM or outside AEM?

Where is it hosted - in AEM or outside AEM?

Does AEM dispatcher talk to AEM publish server for fetching the content and is it configured per Adobe's recommended guidelines?

Avatar

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile
msina
Level 3

23-04-2019

We have already build our primary sites e.g abc.com , xyz.ca  in AEM which is as per Adobe's recommended guideline.

Now we have a new requirement to host one static site "qwe.com" in AEM. And for this we really don't want to put anything in author and publisher side.Just want to put the static files(html,css,js,and fonts) in dispatcher layer.Is this possible?

Or please suggest any other suitable workaround.

Avatar

Avatar
Give Back 50
Employee
Vish_dhaliwal
Employee

Likes

189 likes

Total Posts

356 posts

Correct Reply

123 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Employee
Vish_dhaliwal
Employee

Likes

189 likes

Total Posts

356 posts

Correct Reply

123 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Vish_dhaliwal
Employee

23-04-2019

Hello,

If you want to serve content statically then you will have to configure something like this for site configurations on paths that you don't want to be served by the dispatcher-handler:

<Location />

<IfModule disp_apache2.c>

SetHandler dispatcher-handler

</IfModule>

</Location>

<Location /favicon.ico>

SetHandler default-handler

</Location>

Regards,

Vishu

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

23-04-2019

Technically, this is possible but may not be recommended due to various reasons if you plan to use the same domain for both AEM served content and static content served by web server. This static content would not be managed by Dispatcher in any way but by the web server. You may setup virtual domains/sub-domains or similar solutions based on your requirement.

Follow the best practices/security considerations for each module.

Rather than mounting dispatcher on root ('/'), mount it on a specific pattern for AEM served content and let some other path say /foo to be statically served by apache or do the vice versa using lookahead regex.

Based on you AEM site's dispatcher design, you would need to test that there are no issues in caching/flushing/generation of stat files for the dispatcher managed/mounted path.

Have a separate CI/CD pipeline to compile/transpile/package/deploy your static code into the web server.

Avatar

Avatar
Give Back 5
Employee
SonDang
Employee

Likes

17 likes

Total Posts

43 posts

Correct Reply

9 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile

Avatar
Give Back 5
Employee
SonDang
Employee

Likes

17 likes

Total Posts

43 posts

Correct Reply

9 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile
SonDang
Employee

23-04-2019

Another solution for this would be to have multiple virtual hosts within Apache. Each virtual host would have its own separate document root. Avoid nested the sites within each other folder structure. The static site will reside in one location and the site serving content from AEM will be in a separate location. Just make sure the Dispatcher configuration manage content in one location.

Avatar

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile
msina
Level 3

24-04-2019

Thanks all for your feedback.

Avatar

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile
msina
Level 3

25-04-2019

Hi,

We have created the virtual hosts /var/www/html/newsite/newsite.html

And add below configuration in httpd.conf.As soon as we added this now AEM contents are not serving getting 404.Because By default, all requests are taken from this directory /var/www/html.

<Directory "/var/www/html">

         SetHandler default-handler

</Directory>

Any idea how can we separate both traffic.

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

25-04-2019

Assuming that you're asking for how to setup virtual host config--

Using Dispatcher with Multiple Domains

set up one for dispatcher served content and other for apache served content

<VirtualHost *:80> ServerName branda.com DocumentRoot /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea <Directory /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea> <IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On </IfModule> Options FollowSymLinks AllowOverride None </Directory> </VirtualHost> 

VirtualHost Examples - Apache HTTP Server Version 2.4

Keep separate docroots & directory paths

 DocumentRoot /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea  and 
<Directory /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea>




DocumentRoot /usr/lib/apache/httpd-2.4.3/htdocs/content/siteb and

<Directory /usr/lib/apache/httpd-2.4.3/htdocs/content/siteb>

If you plan to use the same shared location "/var/www/html" as mentioned in my above post, then use <Location>  or <LocationMatch> tags

Avatar

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile

Avatar
Give Back 10
Level 3
msina
Level 3

Likes

13 likes

Total Posts

52 posts

Correct Reply

1 solution
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 3
View profile
msina
Level 3

07-05-2019

Hi All,

We have configured the site bit different way.We put the contents (html,image and assets css js etc) inside

e.g /var/www/html/newsite/index.html                      

And created a softlink of newsite folder in ur docroot  and configure the rewrite rule in httpd.conf  accordingly .Its working fine.

1748143_pastedImage_1.png

Thanks all for your suggestion.