Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Today I am trying to install httpd and mysql on my fedora 14 PC. That works fine. After this I try to create a public_html folder on the user directory and allow php to access that folder. For that I am following this link. Now when I am try to access that folder it shows forbidden message on my browser. To avoid this I Googled my problem which gave me this link. When I try setsebool -P httpd_enable_homedirs=1
Now my browser shows Internal server error.

My ERROR LOG

    [Tue Apr 01 09:01:28 2014] [notice] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Tue Apr 01 09:01:28 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Apr 01 09:01:28 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Apr 01 09:01:28 2014] [notice] Digest: done
[Tue Apr 01 09:01:30 2014] [notice] Apache/2.2.17 (Unix) DAV/2 PHP/5.3.8 configured -- resuming normal operations
[Tue Apr 01 09:08:45 2014] [crit] [client 127.0.0.1] configuration error:  couldn't perform authentication. AuthType not set!: /~BON4/
[Tue Apr 01 09:08:52 2014] [crit] [client 127.0.0.1] configuration error:  couldn't perform authentication. AuthType not set!: /~BON4/HH.php
[Tue Apr 01 09:08:52 2014] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
share|improve this question
    
What's in the error_log of Apache HTTPd? –  Daniel B Mar 18 at 10:15
    
@DanielB how can I see apache error_log? –  Lal krishnan Mar 18 at 11:12
    
Apparently, the default location is /var/log/httpd/error_log. –  Daniel B Mar 18 at 12:01
    
@DanielB Now you can see my error log –  Lal krishnan Mar 19 at 10:04
    
post your /etc/httpd/httpd.conf –  metacom Apr 7 at 1:58

4 Answers 4

Put some contents (like index.php or index.html) in the public_html directory inaccordance with your configuration of webserver.And yes it would be helpful if you provide error logs.

share|improve this answer
    
I am tried a lot. Still which shows Internal server error. –  Lal krishnan Mar 19 at 9:48
    
Please provide error_logs –  vic Mar 19 at 9:49
    
Now you can see my error log –  Lal krishnan Mar 19 at 10:04

Try

<Directory />

   Options FollowSymLinks
   AuthType None
   AllowOverride None
   Order deny,allow
   Deny from all
</Directory>

<Directory "/opt/your_folder/*">

   Options FollowSymLinks MultiViews
   AllowOverride None
   AuthType None
   Order deny,allow
   Allow from all
</Directory>

It seems to be a permission error with the folder you created in the web directory.

share|improve this answer
    
Where I need to place this?? –  Lal krishnan Apr 1 at 5:54
    
In your httpd.conf. Don't copy paste these lines as such.what you have to is check your httpd.conf and find out whether you provided permission to the folder or not. Check Deny from all and Allow from all lines in your conf file. –  Renju Chandran chingath Apr 1 at 6:52
    
I am tried but no change.. –  Lal krishnan Apr 1 at 7:09

The link you followed specified for both version 2.2 and 2.4; I suspect you need to remove Require all granted from /etc/httpd/conf.d/userdir.conf as Fedora 14 ships with Apache 2.2.

I'd also recommend reading http://httpd.apache.org/docs/2.2/mod/mod_userdir.html for a better overview of mod_userdir in apache 2.2

share|improve this answer

The website you want run must be the way as it was mentioned in your link(using selinux and in /home/user/public_html). I f thats not the case than please disable the selinux and try to put some content in /var/www/html and also comment the userdir module. And if you want to configure it in the /home/user/public_html than please consider vhosts(virtualhost) entry in your httpd.conf file. Because in-case of selinux enabled you have to make policies what to allow and what to not.

Vhost setup:

As the default permissions only allow us, the 'demo' user, to browse our home folder, let's start off by giving Apache access to this folder as well:

chmod 755 /home/demo

OK, now we need to create the directory structure for our sites.

In your home directory create a 'public_html' folder:

cd ~ mkdir public_html

Now, for each domain we want to host, create a folder with a standard set of sub-folders:

mkdir -p public_html/domain1.com/{public,private,log,cgi-bin,backup}

That will create the folders public, private, log, cgi-bin and backup for each of our domain (domain1.com).

index.html

The content of the public folder is, entirely, up to you but for this example I am going to use a very simple HTML file so we can check that the virtual hosts work correctly:

For each domain let's create the index.html file:

vi public_html/domain1.com/public/index.html

Let's go ahead and uncomment the generic NameVirtualHost in the Apache configuration.

Navigate to the /etc/httpd/conf directory and open the main Apache configuration file (httpd.conf):

sudo vi httpd.conf

Now we can restart Apache to initiate the changes:

sudo /etc/init.d/httpd restart

Custom Virtual Hosts

We've setup the basics and now we're ready to add our own virtual hosts so that we can start to serve our domains.

Let's create the vhost for domain1:

sudo vi /etc/httpd/conf/httpd.conf

At the bottom of the httpd.conf file, we need to add the following:

# Admin email, Server Name (domain name) and any aliases ServerAdmin webmaster@domain1.com ServerName domain1.com ServerAlias www.domain1.com

# Document Root (where the public files are located) DocumentRoot /home/demo/public_html/domain1.com/public # Custom log file locations LogLevel warn ErrorLog /home/demo/public_html/domain1.com/log/error.log CustomLog /home/demo/public_html/domain1.com/log/access.log combined

OK good, now we need to reload Apache:

sudo /etc/init.d/httpd reload

Now navigate to your site:

share|improve this answer
    
don't plagiarize answers, summarize & attribute them. rackspace.com/knowledge_center/article/…. –  Sathya May 10 at 5:35

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.