selinux对linux服务的影响

实验一:使用 web 服务演示安全上下文值的设定


root@localhost \~\] # systemctl restart nginx 通过客户端测试,出现 403 状态码 # 修改自定义目录的安全上下文的值: \[root@localhost \~\] # chcon -t httpd_sys_content_t /www/ -R 也可以将自定义目录的安全上下文的值按照 /var/www/html 文件修改: \[root@localhost \~\] # chcon -R --reference=/usr/share/nginx/html/index.html /www 修改之后即可成功访问。 实验二:使用 web 服务端口的改变来演示端口的设定 \[root@localhost \~\] # vim /etc/httpd/conf.d/host.conf \[root@master-dns \~\] # cat /etc/nginx/conf.d/test_port.conf server { listen 192 .168.168.153:80; root /www/port/80; location / {} } server { listen 192 .168.168.153:10000; root /www/port/10000; location / {} } \[root@localhost \~\] # mkdir -pv /www/port/{80,10000} \[root@localhost \~\] # echo the port is 80 \> /www/port/80/index.html \[root@localhost \~\] # echo the port is 10000 \> /www/port/10000/index.html \[root@master-dns \~\] # systemctl restart nginx # 服务重启失败,查看日志 \[root@localhost \~\] # tail -f /var/log/messages # 添加 10000 端口为服务端口: \[root@localhost \~\] # semanage port -a -t http_port_t -p tcp 10000 \[root@master-dns \~\] # systemctl restart nginx \[root@master-dns \~\] # curl 192.168.168.153:10000 the port is 10000 # 测试可以访问成功 ![](https://i-blog.csdnimg.cn/direct/60a4fb17be52485aa62dbab09395cc64.png)

相关推荐
tianshiyeben1 天前
日志审计系统WGLOG介绍 - 怎么采集防火墙的日志
运维·服务器·网络·日志审计
乾元1 天前
算力优化: 在有限硬件资源下进行安全模型微调(Fine-tuning)
网络·人工智能·神经网络·安全·web安全·机器学习·安全架构
oradh1 天前
Oracle 11g tar包方式安装数据库软件
数据库·oracle
顶点多余1 天前
Mysql——表的约束
数据库·mysql
高高山上立1 天前
HP Anyware License Server 26.01 Linux 管理员指南
运维·服务器·hp anyware
头疼的程序员1 天前
计算机网络:自顶向下方法(第七版)第三章 学习分享(三)
网络·学习·计算机网络
硅农深芯1 天前
蚀刻停止层:半导体制造中的主流绝缘防护屏障
网络·制造·芯片制造·蚀刻停止层
娇娇yyyyyy1 天前
QT编程(7): Qt主窗口和菜单栏
数据库·qt·microsoft
Leon-Ning Liu1 天前
Oracle 19C RAC升级到 26ai RAC
数据库·oracle