报错:gcc: error trying to exec...
报错原因是系统缺少g++,用如下命令安装即可解决问题:
yum install gcc-c++
重新编译,通过。
报错:ModuleNotFoundError: No module...
这个错误的原因是系统缺少scikit-build依赖。
需要通过如下命令安装:
pip3 install scikit-build
问题解决。
解决UOS终端提示Your system is not...
最近公司里面进行UOS的兼容性验证,但是系统总是会提示:
Your system is not activated. Please activate as soon as possible for normal use.
比较烦人. 今天发现原来他就是一个 systemd的服务 停止了服务就可以了.
systemctl |grep license
systemctl stop license.service
systemctl disable license.service
解决flask_avatars头像无法显示
无法显示头像的原因是flask_avatars使用的是国外的gravatar地址:
https://gravatar.com/avatar/
这个地址国内访问很糟糕,所以需要换成国内的地址。
修改如下文件:
vi /opt/pypy3.10/lib/pypy3.10/site-packages/flask_avatars/__init__.py
将该文件50行的https://gravatar.com/avatar/修改为https://gravatar.cn/avatar/。
如果您使用的不是pypy而是python,就找到python的site-packages目录,修改方法一样。
Nginx安全优化过绿盟漏洞扫描
今日客户服务器攻防演练,扫出了不少网站的安全问题,通过以下设置,可以通过绿盟的漏扫。
以下配置都是基于Nginx的反向代理。
server {
listen 8080;
server_name ocm.shengu.com.cn;
#安全配置开始
#处理缺少头信息的安全问题
add_header Content-Security-Policy "default-src 'self' data: *.shengu.com.cn 'unsafe-inline' 'unsafe-eval' mediastream: ";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options SAMEORIGIN;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header Referrer-Policy "origin";
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
#cookie设置httponly
add_header Set-Cookie "HttpOnly";
#禁用不安全的http方法
if ($request_method ~* OPTIONS|DELETE|SEARCH|COPY|MOVE|PROPFIND|PROPPATCH|MKCOL|LOCK|UNLOCK) {
...
解决pip报错Error: pg_config executable not found.
报错如下:
running egg_info
creating /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info
writing /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-ez6k71_8/psycopg2_binary.egg-info/SOURCES.txt'
Error: pg_config executable not found.
原因是系统缺少postgresql-devel这个包。
解决:
yum install postgresql-devel
重新运行pip安装,问题解决。