Apache 403 in centos64i386 does not have access permissions.

Source: Internet
Author: User

I want to see some HTML documents and put them under the HTTPd service of centos, but I have always been prompted that 403 has no permissions, Which is disgusting to me.

The index.html file cannot be accessed, but it can be accessed by renaming it to index2.html.

Check permissions and user group settings

======================

Because sudo service httpd restart requires root permission, but in/etc/httpd/CONF/httpd. conf

 [root @ arcsdexen1 HTML] #  pwd /var/www/ HTML [root @ arcsdexen1 HTML] # ll total usage   8   drwxr -XR-X.  10  root Root  4096  February 31   18 :  15   help -rwxr-XR-X.  1  root Root  7  February 31   17 :  46   index2.html [root @ arcsdexen1 HTML] # ll .. total usage   16   drwxr -XR-X.  2  root Root  4096  July 22, February   19 :  18  CGI- bindrwxr -XR-X.  3  root Root  4096  July 29, May   16 :  12   errordrwxr -XR-X.  3  root Root  4096  February 31   18 :  15   htmldrwxr -XR-X.  3  root Root  4096  July 29, May   16 :  13   icons [root @ arcsdexen1 HTML] #  

I have modified the user group to Apache: Apache, and changed the permission to-RW-r -- 644,-rwxr-XR-x 755-rwxrwxrwx 777. I have tried it and I do not have the permission, apache, httpd, and I have no permissions for root 777.

Check httpd. conf configuration

============================

First, shut down/etc/httpd/CONF. d/welcome. conf, and skip to the default page without the local main directory index.html.

Vim/etc/httpd/CONF. d/welcome. conf

 
# This configurationFileEnables the default"Welcome"# PageIfThere is no default index page presentFor# The root URL. to disable the welcome page, comment # out all the lines below .##<Locationmatch"^/+ $"># Options-Indexes # errordocument403/Error/Noindex.html #</Locationmatch>

Comment out the file, and then modify the display indexed display file index (if there are no index.html or other webpage files, rename index2.html in the main directory to indexed to display the file index.

Httpd. conf contains default comments

Sub-directories cannot be accessed. Okay, search.

Find this in Apache subdirectory 403Article 

Http://hi.baidu.com/c4bbage/item/b6c4ef244bb9791e097508ac

 
Apache web sub-directory 403 accesses the cunlide website under Apache, and the original content of the website can be accessed, but it does not directly access the sub-directory content if there is more than a URL rewrite. However, when you add HTML to a sub-directory under the root directory, the error 403 is returned. Google is actually a good thing, probably because of SELinux. Therefore, you only need to set the configuration: chcon-R-t httpd_user_content_t [directory name]

After reading it, I am so angry. the most annoying thing is to tell you that you are wrong, but you just cannot find any errors, and it will not prompt you. SELinux: I don't want to learn it. Close it directly.

 

Disable SELinux without restarting the setenforce command.

# Vim/etc/SELinux/Config # ThisFileControls the state of SELinux on the system. # SELinux=Can take one of these three values: # enforcing-SELinux security policy is enforced. # permissive-SELinux prints warnings instead of enforcing. # disabled-No SELinux policy is loaded. # SELinux=Enforcingselinux=Disabled # selinuxtype=Can take one of these two values: # targeted-Targeted processes are protected, # MLS-Multi level security protection. selinuxtype=Targeted # setenforce0
# Getenforce
Permissive

Service httpd restart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.