简体   繁体   English

在Fedora启动时成功启动带有Passenger / mod_rails的Apache

[英]Boot Apache with Passenger/mod_rails successfully when Fedora starts up

PREMISE and PURPOSE PREMISE和PURPOSE

There is this thread about Passenger/mod_rails fails to initialize in Fedora 12 when starting Apache . 有一个关于Passenger / mod_rails的线程在启动Apache时无法在Fedora 12中初始化 Bottom line, the problem is due to the permission, and you can avoid this by calling 最重要的是,问题是由于权限,你可以通过调用来避免这种情况

setenforce 0 

before running 在跑步之前

service httpd start

and calling 并打电话

setenforce 1

after that to set it back. 之后将其设置回来。 It works cool, but I want the sequence to run automatically when Fedora restarts. 它工作很酷,但我希望序列在Fedora重启时自动运行。



PROBLEM 问题

I looked into /etc/init.d/httpd and found out it just redirects to etc/rc.d/init.d/functions , and the key call is 我查看了/etc/init.d/httpd并发现它只是重定向到etc/rc.d/init.d/functions ,并且键调用是

systemctl_redirect $0 $1

So, I thought simply surrounding this call with setenforce calls like this would work. 所以,我认为用这样的setenforce调用简单地围绕这个调用会起作用。

setenforce 0
systemctl_redirect $0 $1
setenforce 1

But it does not work. 但它不起作用。 It emits new error like this (in httpd error log) : 它会发出这样的新错误(在httpd错误日志中):

Cannot change the directory '/tmp/passenger.1.0.8581/generation-0/buffered_uploads' its UID to 48 and GID to 48: Operation not permitted (1)

When I omit the last setenforce 1 , then it finally works! 当我省略最后一个setenforce 1 ,它终于有效了! But obviously I want to set it back somewhere. 但显然我想把它放回某处。



QUESTION

How can I hook these setenforce 0 and setenforce 1 calls to the booting sequence of httpd ? 如何将这些setenforce 0setenforce 1调用挂钩到httpd的启动序列? I am feeling that the most proper way would be to write my own /etc/init.d/httpd script that does not use systemctl , but I want to avoid that since it looks like a thorny path... But if I am wrong and if you can suggest easy way of writing my own etc/init.d/httpd script, I would appreciated that too. 我觉得最合适的方法是编写我自己的/etc/init.d/httpd脚本,它不使用systemctl ,但我想避免这种情况,因为它看起来像一条棘手的路径......但如果我错了如果您可以建议编写我自己的etc/init.d/httpd脚本的简单方法,我也会很感激。

You are using a wrong approach to your problem. 您使用错误的方法来解决问题。 You SHOULD not disable SELinux on you system. 你不应该在你的系统上禁用SELinux。 What you need to do, is trying to figure out the problem, using SELinux Troubleshooter, and add a rule to allow the desired operation. 您需要做的是,尝试使用SELinux Troubleshooter找出问题,并添加规则以允许所需的操作。 Usually they give you the commands you need to run. 通常它们会为您提供运行所需的命令。

First ensure you are using the latest versions available, then if the problem persist, please consider to create a bug report here , you'll get developers assistance. 首先确保您使用的是最新版本,如果问题仍然存在,请考虑在此处创建错误报告,您将获得开发人员的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM