Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a server (OS is CentOS) which has Apache. My default folder is /var/www/html/. When I add my domain this folder it works.

But when I do this in httpd.conf

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /space/www/htdocs

    <Directory /space/www/htdocs>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    ServerName mydomain.com
    ServerAlias www.mydomain.com
    ErrorLog logs/mydomain.com-error_log
    CustomLog logs/mydomain.com-access_log common
</VirtualHost>

403 happens. What should I do?

share|improve this question
1  
Is your /space/www/htdocs folder has same permissions & ownership as /var/www/html –  Raza Jun 20 '13 at 20:15
    
Yes both are root:root. –  borayeris Jun 20 '13 at 20:19
    
root:root, but permissions ? it must be 755 –  Victor Aurélio Jun 20 '13 at 20:23
    
Yes all directories are 755 and files are 644. –  borayeris Jun 20 '13 at 20:29
    
try <Directory "/space/www/htdocs"> instead of <Directory /space/www/htdocs> –  Raza Jun 20 '13 at 20:46

1 Answer 1

up vote 1 down vote accepted

Your setup seems ok.

but you may need to modify the SELinux file context database, or change the SELinux type of certain file.

Run the following command,

semanage fcontext -a -t httpd_sys_content_t '/space(/.*)?'

restorecon -vR /space

by default the file content of your web server is public_content_t, so you need to change into httpd_content_t to allow web server the contents out.

share|improve this answer
    
First of all thank you very very much. My OS is CentOS and it doesn't have semanage by default. So I istalled policycoreutils-python. That way I could use your commands. I've been using *nix amateurishly for 10 years and never heard this type of file permission. I want to learn more about this. What is it? –  borayeris Jun 21 '13 at 19:54
1  
Its comes under the topic of SELinux (Security Enhanced Linux). Refer the link for more info, drupalwatchdog.com/2/2/apache-selinux –  Ram S Jun 24 '13 at 4:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.