Editing httpd.conf (openshift.conf) to create an a

2019-07-24 18:25发布

Is there a way to make a simple edit to (httpd.conf) with OpenShift and have it persist across restarts?

`${HOME}php/configuration/etc/conf.d/openshift.conf`

Here is what I would like to do:

I just need to make an apache directory alias (NOT a DNS alias) and define a directory with some permissions.

Here is what I've tried:

  1. I manually edited the file on rhc and restarted the app from my local command prompt. This overwrote my edited file with the default cartridge file when the restart was complete.

    $ rhc app restart

  2. Added some herdoc statements to my deploy script, commited the change, and pushed to rhc (I didn't think this would work but tried it just in case.)

    #.openshift/action_hooks/deploy cat << EOF >> ${HOME}php/configuration/etc/conf.d/openshift.conf all of my edits ... EOF

Is there a smarter way to do this or must I build my own cartridge to make a simple edit to httpd.conf?

Thanks for your help is much appreciated!

Jay

标签: openshift
1条回答
趁早两清
2楼-- · 2019-07-24 19:20

Found the answer to my own question:

After looking through the documentation for creating a cartridge the answer was staring me in the face (section under first steps talks about creating a symlink to the modules directory.)

What I really wanted to do with the alias was to point to files outside of the ApacheDocument root. FollowSymLinks is enabled in the cartridge, so all I had to do was create a symlink and it did exactly what I was trying to accomplish with the Alias (not sure why I didn't see that sooner).

So instead of this in the apache conf file...

Alias /publicly-visible-alias "/some/path/outside/of/document/root" <Directory "/some/path/outside/of/document/root"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory>

I used this in the .openshift/action_hooks/deploy

ln -s /some/path/outside/of/document/root ${OPENSHIFT_REPO_DIR}/sub-directory/publicly-visible-alias

The .htaccess file inside of /publicly-visible-alias directory took care of all the other details (mod_rewrites, document index, etc... etc...)

Hope this helps someone else.

Jay

查看更多
登录 后发表回答