网页控制界面的安装

PLULib 驱动安装

PLULib 依赖 gcc 5.0 及以上的版本。CAEN 给我们提供了驱动源代码,因此使用我们的程序包则不需要安装以下 PLULib 驱动。

### 使用 吴鸿毅 提供的网页控制程序,请不要安装以下驱动!!!!!!
tar -zxvf CAEN_PLULib-1.1.0-Build20190924.tgz
cd CAEN_PLU-1.1
sh install_x64
cd ..

CentOS 7

apache

CentOS 7(Scientific Linux 7) 配置文件路径

/etc/httpd/conf/httpd.conf

selinux 关闭

getenforce # 查看selinux状态
setenforce 0 # 临时关闭
修改/etc/selinux/config 文件,将SELINUX=enforcing改为SELINUX=disabled #永久关闭

修改 /etc/httpd/conf/httpd.conf

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options ExecCGI
    Require all granted
</Directory>
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .py .sh

将文件夹 cgi-bin 内文件复制到 /var/www/cgi-bin,将文件夹 html 内文件复制到 /var/www/html

linux 下 apache启动、停止、重启命令

service httpd start  #启动
service httpd restart #重新启动
service httpd stop #停止服务

apache 无法启动

检查log文件 /var/log/httpd/error_log

如果有以下内容,则说明由于SSL证书过期导致无法正常启动

[Mon Feb 15 18:44:20.458085 2021] [:error] [pid 1482] SSL Library Error: -8181 Certificate has expired
[Mon Feb 15 18:44:20.458106 2021] [:error] [pid 1482] Unable to verify certificate 'Server-Cert'. Add "NSSEnforceValidCerts off" to nss.conf so the server can start until the problem can be resolved.

也可通过以下命令来检查证书是否过期

certutil -d /etc/httpd/alias -L -n Server-Cert

简单的处理方法是先设置禁止检查证书,待更新证书后再取消此设置,操作方法:在 /etc/httpd/conf.d/nss.conf 中加入 NSSEnforceValidCerts off 此行设置

firewalld

# 取消firewalld的锁定
systemctl unmask firewalld
## 使用systemctl start firewalld命令开启防火墙的时候,却开不成功,出现Failed to start firewalld.service: Unit is masked的错误,是firewalld服务被锁定了
# 查看firewalld状态
systemctl status firewalld
# 开启防火墙
systemctl start firewalld
##没有任何提示即开启成功
# 关闭防火墙
systemctl stop firewalld
# 重启防火墙
firewall-cmd --reload
# 查询TCP/UDP的80端口占用情况
firewall-cmd --query-port=80/tcp
firewall-cmd --query-port=80/udp
## 如果返回结果为“no”,则表示该端口尚未开放
# 永久开放TCP/UDP的端口
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=80/udp

## 提示FirewallD is not running,则防火墙没开启
# 启动 Apache
systemctl start httpd

# 重启http服务
systemctl restart httpd

##查询状态
systemctl status httpd

##  默认监听80端口 /var/www/html

Ubuntu 20

CGI 配置

修改 apache 的 /etc/apache2/conf-enabled/serve-cgi-bin.conf 文件

改为

<IfDefine ENABLE_USR_LIB_CGI_BIN>
        ScriptAlias /cgi-bin/ /var/www/cgi-bin/
        <Directory "/var/www/cgi-bin">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted
                AddHandler cgi-script .cgi .sh
        </Directory>
</IfDefine>

启用 cgi mod

sudo ln -s /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/cgid.conf
sudo ln -s /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/cgid.load
sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load

重启apache服务

sudo /etc/init.d/apache2 restart

网页配置

以上 CentOS/Ubuntu,共用一套网页控制源码,将 wwwcgi-binhtml 两个文件夹中的程序,复制到 /var/www 中的相应文件夹中。

然后进入 /var/www/cgi-bin 文件夹,使用 root 权限执行,make clean ,然后执行 make