LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   RedHat Apache VirtualHost issues (https://www.linuxquestions.org/questions/linux-server-73/redhat-apache-virtualhost-issues-4175465059/)

baronobeefdip 06-11-2013 08:56 PM

Quote:

Originally Posted by John VV (Post 4969832)
is the folder " /var/drupal" owned by "apache" like /var/www is

I did a chown on it like this
Code:

chown -R apache:apache /var/drupal

Quote:

Originally Posted by TommyC7 (Post 4969922)
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
That's not going to survive a reboot.

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
To see if SELinux is set to enforcing/permissive/disabled.

I diabled SELinux by editing a line in the /etc/selinux/config file
Code:

SELINUX=enforcing
was changed to
Code:

SELINUX=disabled
In the lab I work in they always turn off selinux before doing anything with a red hat machine. So I want to keep selinux off seeing that it's the root to a lot of problems and has been in the past. I just want it to be off. As for the directory piece. I'll try it and see what happens, when I do I'll get back to you

John VV 06-11-2013 09:15 PM

Quote:

So I want to keep selinux off seeing that it's the root to a lot of problems
you really want it set to " permissive " while you are working on it
that way any issues that crop up will be in the se log and "audit2alow " will be able to wright a custom rule ( if needed)
and setroubleshooter will give you and instant notification if there was to be any issues .

set the directory entry in the httpd.conf
SEE: post #13
Code:

<Directory /var/drupal/html>
--- options
--- options
</Directory>


baronobeefdip 06-11-2013 09:25 PM

here is what the config file looks like
Code:

<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>

<VirtualHost *:80>
ServerName joomla.baronobeefdip.josh
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>

It works, The site at the top is the default (when I request it through IP address.) and the one at the bottom is the one that is virtual and must be requested with a name. Thanks for your help, it works now.

baronobeefdip 06-11-2013 09:44 PM

I have a new problem here
Code:

<VirtualHost *:80>
ServerName joomla.baronobeefdip.josh
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>

<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>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
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>
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/localhost.crt
SSLCertificateKeyFile /etc/httpd/ssl/localhost.key
</VirtualHost>

I can request the hosts joomla.baronobeefdip.josh and drupal.baronobeefdip.josh. I execute the rewrite module like you see here so when I request the drupal host I will be redirected to the other drupal site which deploys ssl on port 443. But what is happening now is that whenever I request the drupal host I get redirected to the joomla one but with an SSL connection. Why is it doing this? I thought virtual host rewrites were relatable with names, so that whenever I do a port 80 request to drupal it will redirect me to the 443 host that uses the drupal directory because it was named drupal. This is more confusing than the last predicament because I now have absolutely no idea what is happening here.


All times are GMT -5. The time now is 09:18 PM.