centos7 Apache 网站出现403无法访问


我使用的是centos7,安装Apache 2.4.x,并且还安装了vsftpd,配置了用户 xxx.com
根目录 /var/virtual/xxx.com/public_html,用户目录 /var/virtual/xxx.com

当我设置 /var/virtual/xxx.com/public_html 的所有者为 Apache的时候,可以访问。
但vsftpd无法登录,改为 xxx.com 这个用户,vsftpd可以登录,Apache访问出现403提示。


 
[root@localhost virtual]# mkdir -p /var/virtual/xxx.com/{public_html,logs,backup} [root@localhost virtual]# useradd xxx.com -g apache -d /var/virtual/xxx.com [root@localhost virtual]# chown xxx.com: -R /var/virtual/xxx.com [root@localhost virtual]# ls -l /var/virtual/xxx.com total 12 drwxr-xr-x 2 xxx.com apache 4096 Sep 9 00:50 backup drwxr-xr-x 2 xxx.com apache 4096 Sep 9 00:51 logs drwxr-xr-x 2 xxx.com apache 4096 Sep 9 09:50 public_html [root@localhost virtual]# ftp localhost Trying ::1... ftp: connect to address ::1Connection refused Trying 127.0.0.1... Connected to localhost (127.0.0.1). 220 (vsFTPd 3.0.2) Name (localhost:root): xxx.com 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 227 Entering Passive Mode (127,0,0,1,34,100). 150 Here comes the directory listing. drwxr-xr-x 2 1000 48 4096 Sep 08 16:50 backup drwxr-xr-x 2 1000 48 4096 Sep 08 16:51 logs drwxr-xr-x 2 1000 48 4096 Sep 09 01:50 public_html 226 Directory send OK. ftp> exit 221 Goodbye. [root@localhost virtual]# [root@localhost virtual]# sestatus SELinux status: disabled [root@localhost virtual]# uname Linux [root@localhost virtual]# uname -a Linux localhost.localdomain 3.15.4-x86_64-linode45 #1 SMP Mon Jul 7 08:42:36 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux [root@localhost virtual]#

备注

selinux已经关闭

apache 403-forbidden centos

Nemo夜愿 10 years, 3 months ago
  • chcon -R -t httpd_user_content_t public_html/ <path to web files>
  • chcon -R -t httpd_sys_content_t <path to web files>
Xuper answered 10 years, 2 months ago

好多年不用ftp了,基本上正在推广git部署。

一航戦D誇り answered 10 years, 2 months ago

ftp配置的问题?

吹走的帽子君 answered 10 years, 2 months ago

建议放弃陈旧粗糙的ftp,可以通过git部署,或者sftp。

身寸亻尔忆莲 answered 10 years, 2 months ago

Your Answer