首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Raspberry Pi fhem web界面不可及

Raspberry Pi fhem web界面不可及
EN

Stack Overflow用户
提问于 2013-10-17 13:37:16
回答 1查看 2.7K关注 0票数 0

今天,我在我的Raspberry Pi上安装了Arch,并开始安装fhem。在使用yaourt安装了fhem之后,我定制了fhem配置,编写了一个systemd *.service文件,并使用以下方法启动了服务:

代码语言:javascript
复制
sudo systemctl start fhem
sudo systemctl enable fhem

然后,我使用systemctl状态fhem检查了服务器状态,这给出了以下内容:

代码语言:javascript
复制
fhem.service - FHEM Perl Server
   Loaded: loaded (/etc/systemd/system/fhem.service; enabled)
   Active: inactive (dead) since Thu 2013-10-17 15:20:42 CEST; 11min ago
  Process: 480 ExecStart=/usr/bin/perl fhem.pl fhem.cfg (code=exited, status=0/SUCCESS)
 Main PID: 480 (code=exited, status=0/SUCCESS)

Oct 17 15:20:41 alarmpi systemd[1]: Started FHEM Perl Server.

因此服务器似乎在运行,于是我切换到我的桌面PC,并试图通过将firefox指向192.168.1.77:8083来访问fhem web界面。

代码语言:javascript
复制
Firefox can't establish a connection to the server at 192.168.1.77:8083 

所以我试着给树莓派做了个很好的选择。有人知道为什么我不能连接到fhem的网页界面吗?请在下面找到我的配置文件。

/etc/fhem/fhem.cfg

代码语言:javascript
复制
attr global logfile ./log/fhem-%Y-%m.log
attr global modpath .                  # where our FHEM directory is
attr global statefile ./log/fhem.save  # where to save the state of the devices
attr global verbose 3                  # "normal" verbosity (min 1, max 5)

define telnetPort telnet 7072 global   # our TCP/IP port

define WEB FHEMWEB 8083 global

define WEBphone FHEMWEB 8084 global
attr WEBphone stylesheetPrefix smallscreen

define WEBtablet FHEMWEB 8085 global
attr WEBtablet stylesheetPrefix touchpad

# Fake FileLog entry, to access the fhem log from FHEMWEB 
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog

define autocreate autocreate
attr autocreate autosave
attr autocreate device_room %TYPE
attr autocreate filelog ./log/%NAME-%Y.log
attr autocreate weblink
attr autocreate weblink_room Plots

# Disable this to avoid looking for new USB devices on startup
define initialUsbCheck notify global:INITIALIZED usb create 

/etc/systemd/system/fhem.service

代码语言:javascript
复制
[Unit]
Description=FHEM Perl Server
After=syslog.target network.target

[Service]
User=fhem
WorkingDirectory=/opt/fhem
ExecStart=/usr/bin/perl fhem.pl fhem.cfg
Type=simple 

[Install]
WantedBy=multi-user.target

/etc/iptables/iptables.rules

代码语言:javascript
复制
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p udp -m udp --dport 123 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A OUTPUT -p udp -m udp --sport 123 -j ACCEPT
COMMIT
EN

Stack Overflow用户

回答已采纳

发布于 2013-10-22 13:53:44

我能够使用以下systemd服务文件(主要修改“Type=forking”)来实现您想要实现的目标:

代码语言:javascript
复制
[Unit]                                                                                                 
Description=FHEM Perl Server                                                                           
After=syslog.target network.target                                                                     

[Service]                                                                                              
Type=forking                                                                                                           
User=fhem                                                                                              
WorkingDirectory=/opt/fhem                                                                             
ExecStart=/usr/bin/perl fhem.pl fhem.cfg

此外,由于您似乎在使用"fhem“用户,请确保该用户对所需的文件拥有足够的权限(至少我必须给予它对日志dir的写访问权限)。

FYI在八月有一个包用于fhem,即使它缺少这个服务文件。

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19428301

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档