RedHat Apache VirtualHost issues
I am running CentOS and using it to host a website with Apache httpd server. I was about to create other pages with virtualhosting. The default site that is stored in "/var/www/html" is working fine. But I added the vhost.conf file in the "/etc/httpd/conf.d/" directory and added the following lines.
Code:
<VirtualHost *:80> |
Copy the <Directory>- tag of the existing configuration (with a specified directory = document root) to your virtual host config and replace the directory path.
By default all directories are not visible for the web user. |
You mean like this?
Code:
<Directory /var/joomla> I just tried the lines of code that I specified above in my vhost.conf file and apache came back with an error, can you give me an example of what you mean. |
just tried it like this
Code:
<Directory "/var/drupal/html> |
I think the directory tag should reside within the virtualHost tag but I don't know whether that's the reason. Maybe drupal needs some options like AllowOverride if it is working with htaccess files...
<VirtualHost *:80> ServerName drupal.baronobeefdip.josh DocumentRoot /var/drupal/html <Directory /var/drupal/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> |
see the current Apache documentation for vhost
http://httpd.apache.org/docs/2.4/vhosts/ or the older Apache 2.2 docs http://httpd.apache.org/docs/2.2/vhosts/ |
Still didn't work I want the default host to still be accessible when you simply type in the IP address but I get the / directory again. Plus it's still forbidden. I have been trying to access both the default and the local hosts and none of them are working. Here's my vhost.conf file again
Code:
<IfModule mod_ssl.c> |
this might be a problem
Quote:
Code:
/var/www/drupal/html also for DEBUGGING set SE to permissive READ the errors ( if any ), fix them then set it BACK to Enforcing |
Sounds like SELinux is preventing access. Notice the security context type for /var/www/html is "httpd_sys_content_t" whereas for /var it's just "var_t".
By creating that "wordpress" directory under /var that directory is also given the security context type "var_t" instead of "httpd_sys_content_t" and therefore httpd is not permitted to access the contents of that directory. Try: Code:
chcon -R --reference /var/www/html -t httpd_sys_content_t /var/wordpress Edit: There might be some sebooleans you need to set to make it work too (forgot about those). |
I am just disabling SELINUX, I just remembers that in the lab environment that I am in all the time we would disable selinux on all the machines that were running redhat. I just needed a memory refresher. I'll get back to you and tell you what happens.
|
I just diabled SELINUX like I remember doing in the past. Rebooting the computer and making the vhost file look like this
Code:
<VirtualHost *:80> |
is the folder " /var/drupal" owned by "apache" like /var/www is
|
Quote:
Code:
<Directory /var/drupal/html> |
Alongside what else has been said, you haven't told us how you turned off SELinux (I recommend keeping it on by the way except for debugging purposes).
If you used: Code:
setenforce 0 Also, there's no need to reboot the entire machine if all you're going to do is restart a service or just change the permissions of a directory. For future reference, use Code:
sestatus |
set SE to "permissive" for testing
this will tell "SElinuxTroubleShooter" about problems that will stop something from running IF it were in "enforcing" mode then set back to enforcing after things are fixed |
All times are GMT -5. The time now is 07:29 PM. |