Apache server and directory index

I have a Caché server with external apache.

It has a hostname, i.e.: http://myserver.com

There is an index page, which is available over http://myserver.com/index.html (/ is a Caché CSP app)

How can I make index.html available from http://myserver.com?

Here's the relevant parts of my apache config:

<Directory />
    CSP On
    DirectoryIndex index.html
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
<Location />
    DirectoryIndex index.html
    Options FollowSymLinks 
    AllowOverride All
    CSP On
    SetHandler csp-handler-sa
</Location>
DirectoryIndex index.html
AccessFileName .htaccess

Additionally I have placed .htaccess file into web app directory:

DirectoryIndex index.html

dir module is enabled.

 

UPD. Correct config:

Alias / /opt/Cache/csp/app/

<Directory /opt/Cache/csp/app/>
    DirectoryIndex index.html
    Options FollowSymLinks
    Require all granted
</Directory>

<Location />
    CSP On
    SetHandler csp-handler-sa
</Location>

.htaccess file is not required.

  • 0
  • 0
  • 365
  • 2
  • 1

Answers

Directory tag should point to the directory on the server, where you files are located.

And you also should have defined Alias directive, which should say which physical directory should be used for particular web path

Alias / /srv/www
<Directory /srv/www>
...
</Directory>

CSP on, can be used either in Directory or Location directive. But you should remember the difference between them. Directory point to the physical path, while Location works with URL. As well as also possible to use DirectoryMatch and LocationMatch, which supports regex.

But with CSP on, all requests will be sent directly to CSPgateway and then to Caché. And if something not working you should check CSPGateway, sometimes it needs to be restarted, usually all parts (depends on configuration, and plus CSPnsd), after some changes in list of CSP Applications

I have modified Directory to point to a physical path, and restarted Caché. Still getting 404.

 

UPD. Adding trailing slash to directory name solved my problem.

Thank you.