Editing httpd.conf (openshift.conf) to create an apache Alias

南笙酒味 提交于 2019-12-11 12:39:36

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/24391720/editing-httpd-conf-openshift-conf-to-create-an-apache-alias

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!