检查http.conf发现没错之后,查找资料后发现时selinux的问题,所以需要关闭这个服务:
1
|
vi /etc/sysconfig/selinux
|
2
|
SELINUX=enforcing
改为 SELINUX=disabled
|
重启后生效
不需重启 执行命令:
*********************************************************
在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
分享到:
相关推荐
What You Will Learn * See how to deploy CentOS easily and painlessly, even in multi-server environments * Configure various methods of remote access to the server so you don't always have to be in ...
By the end of this book, you will have a fair understanding of all the aspects of configuring, implementing and administering CentOS 7 Linux server and how to put it in control. Style and approach ...
How to install VNC server on Centos 7
This book will provide you with a comprehensive series of starting points that will give you direct access to the inner workings of the latest CentOS version 7 and help you trim the learning curve to ...
By the end of this book, you will have the skills required to independently design, implement, and maintain a CentOS high availability multinode cluster environment. Table of Contents Chapter 1: ...
Docker仓库上传镜像出现 unauthorized to access repository的解决方法
SQLserver 2019 on centos 7.5安装文档,只需按图操作即可
You don’t need to be a programmer to take advantage of this book. Perhaps you are someone who just wants to use Linux to run programs, access the Internet, and so on. Or, perhaps you are someone who ...
The high performance and stability... By the end of this book, you will have the skills required to independently design, implement, and maintain a CentOS high availability multinode cluster environment.
centos7 svnserver 安装
How To Install nginx on CentOS 6 with yum
This book teaches you to set up the latest CentOS Linux network services including DNS, DHCP, SSH and VNC, Web, FTP, Mail, Firewall, and LDAP, enabling you to provide these services on your own ...
本文档介绍基于centos7平台的liunx系统下,安装+还原+卸载sqlserver方法,亲测有效
Moving on, we will provide you with all the knowledge that will give you access to the inner workings of the latest CentOS version 7. Finally, touching RHEL 7, we will provide you with solutions to ...
This book will introduce you to essential Linux skills using CentOS 7. It describes how a Linux system is organized, and will introduce you to key command-line concepts you can practice on your own. ...
CentOS 7上安装FTP教程(参考文档中url操作,并记录)
这是Linux系统的CentOS相关的英文书籍,是免积分的哦