简体   繁体   English

使用非Apache用户在非Apache端口上运行PHP应用程序

[英]Run PHP Application on non apache port, with non-apache user

We have a PHP application which automates script commands. 我们有一个自动化脚本命令的PHP应用程序。 Many of these are through web interfaces. 其中许多是通过Web界面。 I want this php application user to be running lots of cli and ssh commands, so I dont really want www-data doing it, as it would involve changing lots of script files to www-data executable permissions, and we want scripts to be entered into web interfaces. 我希望这个php应用程序用户正在运行许多cli和ssh命令,所以我真的不希望www-data这样做,因为它将涉及将许多脚本文件更改为www-data可执行权限,并且我们希望输入脚本进入网络界面。

This application is cross-operating system. 该应用程序是跨操作系统的。 Ideally on anything that php runs on, but win, mac, 理想情况是在运行php的任何设备上运行,但在mac上运行,

The important things that we need to be able to do are (I think) ... 我们需要做的重要事情是(我认为)...

1) Have a Web Server (It's currently Apache, and that's working cross os so that would be great), that is running under normal settings, normal user, reverse proxied to the below application on te same server. 1)拥有一个Web服务器(当前为Apache,并且可以跨操作系统运行,这将是一个很好的选择),它在正常设置,正常用户下运行,并且反向代理到同一服务器上的以下应用程序。 2) Have a PHP application on a different port, running as its own user that can do whatever it wants. 2)在另一个端口上有一个PHP应用程序,以其自己的用户身份运行,可以执行任何所需的操作。

The ability to just run 跑步的能力

php -S localhost:8000

As is available in the built in php web server seems ideal for this. 如内置的php Web服务器中提供的,似乎是理想的选择。 So... 所以...

1) Is it safe to use the PHP built in Web Server if it's behind an apache proxy? 1)如果在Apache代理后面,使用Web服务器内置的PHP是否安全? I'm assuming the fact we are proxying over the entire request anyway means no, since it says not to. 我假设我们无论如何都要代理整个请求,因为它表示不可以。

2) Is there another Web Server/PHP Server that can easily do this? 2)是否有另一个Web Server / PHP Server可以轻松地做到这一点?

3) Is there a way of running two apache processes to do this? 3)是否有运行两个apache进程的方法?

4) Am i doing this the wrong way entirely? 4)我是完全错误地这样做吗? There's another app I know that does it like that, but a Java app and the whole process is started and owned by a non apache user. 我知道还有另一个应用程序可以做到这一点,但是Java应用程序和整个过程是由非Apache用户启动和拥有的。

Thanks in advance 提前致谢

Apache 2.4 + php-fpm + mod_proxy_fcgi will suit you just fine. Apache 2.4 + php-fpm + mod_proxy_fcgi将适合您。

(to elaborate for the downvote -- php-fpm allows the PHP process to run as a separate daemon under its own userid which is exactly the privilege separation requested here) (详细说明一下– php-fpm允许PHP进程在其自己的用户ID下作为单独的守护程序运行,这正是此处要求的特权分离)

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

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