zoukankan      html  css  js  c++  java
  • CentOS出错You don't have permission to access on this server

    检查http.conf发现没错之后,查找资料后发现时selinux的问题,所以须要关闭这个服务:

    1 vi /etc/sysconfig/selinux
    2 SELINUX=enforcing 改为 SELINUX=disabled

    重新启动后生效

    不需重新启动 运行命令:

    1 setenforce 0

    *********************************************************

    在CentOS5.3+MySQL 5.0.45 +Apache2.2.3 +PHP5.1.6中执行PHP程序出错

    You don't have permission to access / on this server

    装好apache+php+mysql后。
    拷贝一份phpmyadmin过后执行出错:
    You don't have permission to access / on this server

    有人说把selinux关掉就好了

    而我发现了这个原因和方法:
    由于站点运行的权限,一般要Read from all httpd scripts and the daemon这个权限。

    当系统内经过解压出来的目录是没有这个权限的。

    我们要在html/下新建一个文件夹(这时会自己主动分为Read from all httpd scripts and the daemon权限)

    然后把档案复制一份过来放进去(注意不是剪切)

    执行试试看吧。



    我就能够了。

    CentOS5.3+MySQL 5.0.45 +Apache2.2.3 +PHP5.1.6(都是系统自带的)


    *********************************************************

    在终端输入   (更改站点根文件夹权限为755。非常多centos系统默觉得700)

    [root@localhost ~]#   chmod  -R 755 /var/www/html/                     

    然后重新启动

    [root@localhost ~]#   /etc/init.d/httpd restart


    *********************************************************

    打开apache的配置文件httpd.conf,逐行检查。在大约快一半的地方有下面这段代码:

        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all

    发现了吧。

    因为配置了php后,这里的“Deny from all”已经拒绝了一切连接。把该行改成“allow from all”,改动后的代码例如以下,问题解决。



        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        allow from all

    系统是centos。You don't have permission to access / on this server.
    在google上搜索了一下,大部分的解决方法就是。
     
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all


    这里改成

       Options Indexes FollowSymLinks
        AllowOverride None

    我改了之后还是会出现上面的错误,于是看一下自己设定的工作文件夹权限。
    Options ExecCGI Includes
    改成以下这行设置后,显示正常。


     
    Options Indexes FollowSymLinks
    当訪问类unix操作系统上的/usr/local/apache2/htdocs/foo/bar.htm文件时,你收到了Permission Denied的错误。


    首先,查看文件的訪问权限:

    $ cd /usr/local/apache2/htdocs/foo
    $ ls -l bar.htm

    假设需要的话,就修复它们:

    $ chmod 644 bar.html
    对目录以及每一个父目录做同样的操作
     
    (/usr/local/apache2/htdocs/foo,/usr/local/apache2/htdocs,/usr/local/apache2,/usr/local/,/usr):
    $ ls -la
    $ chmod +x
    $ cd ..
    $ #repeat up to the root
    在一些系统上。可使用工具namei来列出各个路径上的不同组件的訪问权限。然后去发现是否有权限问题:
     
    $ namei -m /usr/local/apache2/htdocs/foo/bar.html


  • 相关阅读:
    nfs-client-provisioner 利用NFS动态提供Kubernetes后端存储卷
    docker-compose简易编写和模板命令
    shell脚本自动过滤尝试多次连接ip并添加到系统黑名单
    Centos 升级glibc 亲测好用
    centos安装Jenkins报错
    centos8 安装docker启动失败
    cenots7 rpm 包升级ssh
    python备份文件(简易)
    Docker 容器基本操作(基础)
    Docker 环境下如何配置你的镜像(基础)
  • 原文地址:https://www.cnblogs.com/yfceshi/p/7054883.html
Copyright © 2011-2022 走看看