0

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
5
  • What's in the error_log of Apache HTTPd?
    – Daniel B
    Mar 18, 2014 at 10:15
  • @DanielB how can I see apache error_log? Mar 18, 2014 at 11:12
  • Apparently, the default location is /var/log/httpd/error_log.
    – Daniel B
    Mar 18, 2014 at 12:01
  • @DanielB Now you can see my error log Mar 19, 2014 at 10:04
  • post your /etc/httpd/httpd.conf
    – metacom
    Apr 7, 2014 at 1:58

4 Answers 4

1
+50

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.

3
  • I am tried a lot. Still which shows Internal server error. Mar 19, 2014 at 9:48
  • Please provide error_logs
    – vic
    Mar 19, 2014 at 9:49
  • Now you can see my error log Mar 19, 2014 at 10:04
1

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.

3
  • Where I need to place this?? Apr 1, 2014 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. Apr 1, 2014 at 6:52
  • I am tried but no change.. Apr 1, 2014 at 7:09
0

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

-1

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 [email protected] 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:

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .