我目前正在尝试设置家庭网络服务器。我有很多使用C#编程的经验,并且多年来一直使用Visual Studio和IIS。我最近决定转向Linux并使用MonoDevelop重建我的代码库。我让他们在我的开发机器上编译,所以我正在使用Fedora 22 Server和Apache 2.4建立一个家庭服务器。
只使用默认配置,服务器能够毫无问题地提供html页面,但是当我安装Mono及其依赖项时,我遇到了各种错误,而且对于我经验有限的人来说,它们不够详细解决。我花了整整一周的时间研究这个问题,这就是我被困的地方。
浏览到http://71.41.214.194/LDC-Demo/index.aspx时,浏览器中出现“503 Service Unavailable”错误。查看Apache错误日志时,我得到以下内容:
[Fri Oct 09 15:22:41.809588 2015] [:error] [pid 7577] Failed to connect to mod-mono-server after several attempts to spawn the process.
由于这还不足以辨别问题,我重新启动Apache并尝试重新加载页面(我希望有一个相关的错误可以帮助我追逐问题)
[Fri Oct 09 15:38:22.000257 2015] [mpm_prefork:notice] [pid 7564] AH00170: caught SIGWINCH, shutting down gracefully
[Fri Oct 09 15:38:23.011225 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011668 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011770 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:24.068911 2015] [core:notice] [pid 7641] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Fri Oct 09 15:38:24.069933 2015] [suexec:notice] [pid 7641] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globa$
[Fri Oct 09 15:38:24.079961 2015] [auth_digest:notice] [pid 7641] AH01757: generating secret for digest authentication ...
[Fri Oct 09 15:38:24.080817 2015] [lbmethod_heartbeat:notice] [pid 7641] AH02282: No slotmem from mod_heartmonitor
[Fri Oct 09 15:38:24.088966 2015] [mpm_prefork:notice] [pid 7641] AH00163: Apache/2.4.16 (Fedora) mod_mono/3.12 configured -- resuming normal operations
[Fri Oct 09 15:38:24.088993 2015] [core:notice] [pid 7641] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Oct 09 15:38:36.414478 2015] [:error] [pid 7651] Failed to connect to mod-mono-server after several attempts to spawn the process.
在尽我所能研究这些消息后,我找不到任何与此问题相关的内容。如果我运行命令“journalctl -xe -cat”,我确实发现我可以看到更多细节。
Started The Apache HTTP Server.
mono[7646]: segfault at 5 ip 0000000000512710 sp 00007fffa85f01b0 error 6 in mono-sgen[400000+34d000]
<audit-1130> pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=httpd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Unregistered Authentication Agent for unix-process:7633:25881589 (system bus name :1.83, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7649 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7649]: segfault at 5 ip 0000000000512710 sp 00007ffe5ca30440 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
Not saving repeating crash in '/usr/bin/mono-sgen'
<audit-1400> avc: denied { sigchld } for pid=7647 comm="abrt-hook-ccpp" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=0
Failed to create core_backtrace: waitpid failed: Permission denied
Blacklisted package 'mono-core'
'post-create' on '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644' exited with 1
Deleting problem directory '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644'
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7661 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7661]: segfault at 5 ip 0000000000512710 sp 00007ffed5a32ee0 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
这些消息中有更多信息,但我仍然无法找到原因。最后5行重复三次。
我已经尝试修改apache配置文件(httpd.conf)以及mod_mono.conf文件,但似乎没有什么能让我解决这个问题。
在我当前的配置中,mod_mono.conf文件未从默认配置中修改,我对httpd.conf所做的唯一更改是添加虚拟主机部分,如下所示:
<VirtualHost *:80>
ServerName LDC-Demo
ServerAdmin root@localhost
ServerAlias LDC-Demo
DocumentRoot /var/www/html/LDC-Demo/
MonoServerPath LDC-Demo "/usr/bin/mod-mono-server4"
MonoDebug LDC-Demo true
MonoSetEnv LDC-Demo MONO_IOMAP=all
MonoApplications LDC-Demo "/:/var/www/html/LDC-Demo"
<Location "/LDC-Demo">
Allow from all
Order allow,deny
MonoSetServerAlias LDC-Demo
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
</VirtualHost>
如上所述,任何想法都会受到赞赏,我整个星期都在努力,并没有取得多大进展。
答案 0 :(得分:3)
我在上面作为评论进入上述内容,但我打算回答这个问题。
我把它弄清楚了。 Fedora运行SELinux,它干扰了mod_mono运行所需的权限。要查看这些设置,我运行了命令:getenforce然后暂时更改设置我使用了以下命令:setenforce 0最后,重新启动Apache:apachectl restart我刷新了Web浏览器并正确加载了页面。要进行永久设置,请编辑selinux文件:nano / etc / sysconfig / selinux我重新启动了服务器,并尝试再次加载网页。找到了!一切正常。