无法在CentOS 7上将hhvm用户从hhvm更改为nginx



我可以使用用户HHVM运行HHVM,因为它是默认的。但当我试图将用户更改为nginx时,我在检查其状态时出错。

$ vim /usr/lib/systemd/system/hhvm.service

我添加以下

[Unit]
Description=HipHop Virtual Machine (FCGI)
[Service]
ExecStart=/usr/local/bin/hhvm -c /etc/hhvm/server.ini -c /etc/hhvm/php.ini --user nginx --mode daemon
[Install]
WantedBy=multi-user.target

在配置文件上

$ vim /etc/hhvm/server.ini

这是我配置的内容

pid = /var/run/hhvm/pid                           
hhvm.server.ip = 127.0.0.1                        
hhvm.server.port = 9000                           
;hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
hhvm.server.user = nginx                          
hhvm.server.type = fastcgi                        
hhvm.server.default_document = index.php          
hhvm.source_root = /srv/www/public_html           
hhvm.server.always_use_relative_path = false      
hhvm.server.thread_count = 32                     
hhvm.resource_limit.max_socket = 65536            
hhvm.jit = true                                   
hhvm.jit_a_size = 67108864                        
hhvm.jit_a_stubs_size = 22554432                  
hhvm.jit_global_data_size = 22554432              
hhvm.jit_profile_interp_requests = 3              
; mysql                                           
hhvm.mysql.socket = /var/lib/mysql/mysql.sock     
hhvm.mysql.typed_results = true                   
; logging                                         
hhvm.log.use_syslog = false                       
hhvm.log.use_log_file = true                      
hhvm.log.file = /var/log/hhvm/error.log           
hhvm.log.level = Warning                          
hhvm.log.always_log_unhandled_exceptions = true   
hhvm.log.runtime_error_reporting_level = 8191   

之后我运行命令

$ systemctl daemon-reload
$ systemctl start hhvm.service
$ systemctl status hhvm.service

当我检查状态时,我会收到以下消息

hhvm.service - HipHop Virtual Machine (FCGI)
Loaded: loaded (/usr/lib/systemd/system/hhvm.service; enabled)
Active: failed (Result: exit-code) since Fri 2015-04-10 23:43:00 CEST; 2s ago
Process: 2545 ExecStart=/usr/local/bin/hhvm -c /etc/hhvm/server.ini -c /etc/hhvm/php.ini --user nginx --mode daemon (code=exited, status=1/FAILURE)
Main PID: 2545 (code=exited, status=1/FAILURE)
Apr 10 23:43:00 centos7.local systemd[1]: Starting HipHop Virtual Machine (FCGI)...
Apr 10 23:43:00 centos7.local systemd[1]: Started HipHop Virtual Machine (FCGI).
Apr 10 23:43:00 centos7.local systemd[1]: hhvm.service: main process exited, code=exited, status=1/FAILURE
Apr 10 23:43:00 centos7.local systemd[1]: Unit hhvm.service entered failed state.

此外,每次重新启动时,我都必须手动创建此文件夹

$ mkdir /var/run/hhvm

为什么它会自动删除?

您能正常在守护进程模式下启动它吗
只需执行您在服务文件中看到的命令,即ExecStart命令
对于丢失的hhvm文件夹,您可以在使用ExecStartPre启动脚本之前编写一个命令来创建dir,也可以将pid文件的位置更改为/var/run文件夹
@limilaw我认为你可以更改服务文件中的用户,但要小心,因为你可能会把事情搞砸。

最新更新