首页 > 系统相关 >nginx 403

nginx 403

时间:2023-06-02 11:55:49浏览次数:39  
标签:opt SELINUX nginx html 403 conf

一、启动用户和nginx工作用户不一致所致
查看nginx的启动用户:打开nginx.conf文件
vi conf/nginx.conf
user nginx; 改为 user root; 二、nginx.conf中缺少index的指定的文件。 查看nginx的配置:打开nginx.conf文件 server { listen 80; server_name localhost; index index.html; root /opt/html/; } 如果在/opt/html/下面没有index.html的时候,会报403 forbidden。
三、权限问题,如果nginx没有操作权限,也会出现403错误。 解决办法:修改/opt/html/目录的读写权限,或者是把nginx的启动用户改成目录的所属用户,重启Nginx即可解决 chmod -R 777 /opt/html/ 四、SELinux设置为开启状态(enabled)的原因。 查看当前selinux的状态。 /usr/sbin/sestatus
将SELINUX=enforcing 修改为 SELINUX=disabled 状态。 vi /etc/selinux/config #SELINUX=enforcing SELINUX=disabled #注释之前,替换为这个 重启生效:reboot。 转载自:https://blog.csdn.net/weixin_44138647/article/details/103589130
TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
  TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back

标签:opt,SELINUX,nginx,html,403,conf
From: https://www.cnblogs.com/qude/p/17451334.html

相关文章

  • nginx的IP封禁
    在ngnix的conf目录下创建一个blockip.conf文件里面放需要封禁的IP,格式如下deny1.2.3.4;在ngnix的HTTP的配置中添加如下内容includeblockips.conf;重启ngnix/usr/local/nginx/sbin/nginx-sreload然后你就会看到IP被封禁了,你会喜提403;小思考:如何实现使用ngnix自动封禁ip的功能1.......
  • Nginx 平滑升级
    Nginx平滑升级nginx/1.20.1--->1.22.11、查看原编译参数nginx-V--------------------------------------------nginxversion:nginx/1.20.1builtbygcc4.8.520150623(RedHat4.8.5-44)(GCC)builtwithOpenSSL1.0.2k-fips26Jan2017TLSSNIsupportenab......
  • Nginx:CVE-2021-23017;CVE-2022-41742
    nginx安全漏洞(CVE-2021-23017)详细描述Nginx是美国Nginx公司的一款轻量级Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。nginx存在安全漏洞,该漏洞源于一个离一错误在该漏洞允许远程攻击者可利用该漏洞在目标系统上执行任意代码。受影响版本0.6.18-1.20.0解决......
  • NGINX版本信息泄露
    NGINX版本信息泄露详细描述在请求的响应信息中显示Nginx版本信息影响攻击者可能使用泄露的版本信息来确定该版本服务器有哪些安全漏洞,据此展开进一步的攻击。解决办法Nginx配置文件里增加server_tokensoff;官方语法说明:http://nginx.org/en/docs/http/ngx_http_core......
  • 银河麒麟v10操作系统之nginx 安装&部署
    yum-yinstallgccpcrepcre-develzlibzlib-developensslopenssl-devel安装的插件的作用1.gcc可以编译C,C++,Ada,ObjectC和Java等语言(安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境)2.pcrepcre-develpcre是一个perl库,包括perl兼容的正则表达......
  • P4036 [JSOI2008] 火星人
    暴力水过了wwwwwwwwwwwwwww#include<bits/stdc++.h>//================================================//#defineLOCALFLANDREKAWAII#ifndefLOCALconstexprintSIZE(1<<20);charin[SIZE],out[SIZE],*p1=in,*p2=in,*p3=out;#definegetchar(......
  • nginx 配置 https
    nginx配置https按照如下格式修改配置文件,80端口会自动转给443端口,这样就强制使用SSL证书加密了。访问http的时候会自动跳转到https上面。server{listen80;server_namewww.域名.com;rewrite^(.*)https://$server_name$1permanent;}server{listen443;se......
  • nginx 负载均衡
    负载均衡http://nginx.org/en/docs/http/load_balancing.html轮询(不写directive )upstreammyapp1{serversrv1.example.com;serversrv2.example.com;serversrv3.example.com;}最小活跃连接数upstreammyapp1{lea......
  • 离线安装nginx
    离线安装nginxgcc-c++该链接内有安装nginx所需的环境openssl、pcre、zlib直接执行该命令安装即可rpm-Uvh*.rpm--nodeps--force将下载好的nginx源码包(nginx-1.21.6.tar.gz)解压缩到/usr/local目录下,顺序执行以下命令cdnginx-1.21.6./configuremake&&makeinstall......
  • Nginx配置隐藏模块后的.php后缀
    要在Nginx中配置隐藏框架模块后的.php后缀,并将URL重写为http://example.com/index/user/profile,请按照以下步骤进行操作:1.  打开Nginx配置文件。2.  添加以下配置,启用URL重写和模块隐藏:server{listen80;server_nameexample.com;root/pat......