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)

相关推荐
yexuhgu2 分钟前
MySQL主从复制支持跨版本吗_不同版本间同步的注意事项
jvm·数据库·python
woxihuan1234568 分钟前
CSS怎样调整弹性项目排列顺序_使用order属性轻松控制DOM显示顺序
jvm·数据库·python
treesforest12 分钟前
IP地理位置精准查询:从城市级到街道级的定位技术深度解析
大数据·网络·网络协议·tcp/ip·安全·网络安全·ip
m0_7485548120 分钟前
golang如何实现数据去重处理_golang数据去重处理实现步骤
jvm·数据库·python
骑着骆驼写程序21 分钟前
Ubuntu上部署前端项目报500错误
linux·运维·ubuntu
江南十四行24 分钟前
网络编程基础:TCP/IP与Socket编程详解
网络·python·http
心机之蛙qee28 分钟前
docker的安装(RHEL9)
运维·docker·容器
神明93128 分钟前
mysql索引排序规则设置方法_mysqlCollation对索引影响
jvm·数据库·python
Project_Observer28 分钟前
使用Zoho Projects记录工时时间后自动更新项目预算。
开发语言·数据库·人工智能·深度学习·机器学习
神明93130 分钟前
CSS如何实现打字机效果_利用animation与宽度变化
jvm·数据库·python