Cloud Agent, Apache, and drupal's .htaccess - .htaccess

Installed Apache and Cloud Agent.
Agent collects information from mod_status. Everything is ok.
However, when I add drupal files (with .htaccess), Agent can't collect stat anymore.
I already tried many configuration and now I am super confused about VirtualHosts. I used standard agent's configuration for virtualhost:
ExtendedStatus on
<VirtualHost 127.0.0.1:80>
ServerName local-stackdriver-agent.stackdriver.com
<Location /mod_status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
</VirtualHost>
In http.conf I changed only DocumentRoot.
Can someone please explain me why the requests go to drupal's folder, and not to local-stackdriver-agent.stackdriver.com VirtualHost?

Related

mod_rewrite is enabled, .htaccess file is ok, but requests are not going through index.php

I've just installed ubuntu-server_6.04.2_LTS, after the fresh installation I've enabled mod_rewrite, it's showing in phpinfo()
my .htaccess file is OK
but, still requests are not going through index.php
You should check if for that specific directory (root folder of your project), apache is configured to allow overriding through .htaccess.
If you want to allow such override, the directives found in apache.conf or the specific settings for your virtual host should look like this:
<Directory /var/www/>
AllowOverride All
Require all granted
</Directory>

Url rewriting not working in WAMP Subdomain

I created a Subdomain under my WAMP server for mobile site and it uses IP address as the domain name which is 192.168.106.1
But the issue is that when I try to rewrite a url in my .htaccess file, I doesn't work. And I use a duplicated .htaccess file which works for the localhost
Below is my server configuration for the domain name in my httpd.conf file
<VirtualHost 192.168.106.1>
#LoadModule rewrite_module modules/mod_rewrite.so
# The name to respond to
ServerName m.localhost
# Folder where the files live
DocumentRoot "C:/wamp/www/mobile/"
# A few helpful settings...
<Directory "C:/wamp/www/mobile/">
Allow from all
Order Allow,Deny
# Enables .htaccess files for this site
AllowOverride All
</Directory>
# Apache will look for these two files, in this order, if no file is specified in the URL
DirectoryIndex index.html index.php
</VirtualHost>
I also removed the comment tag on the second line but it still not working.
Please anyone with a solution?
Here is a solution
First make sure you go to your C:/wamp/bin/apache/YOUR APACHE VERSION/conf and open up your httpd.conf file and uncomment this line
#Include conf/extra/httpd-vhosts.conf
So it will look like this
Include conf/extra/httpd-vhosts.conf
Then also open up your host file located in C:/windows/System32/drivers/etc and add this (your ip address to the configuration)
#add the sub-domain name, in this case I use mobile, it can be anything
192.168.106.1 mobile.localhost
192.168.106.1 192.168.106.1
Then finally and most importantly, open up your vhost file in C:/wamp/bin/apache/YOUR APACHE VERSION/conf/extra/httpd-vhosts.conf and add this to the file
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/mobile"
ServerName m.localhost
Options Indexes FollowSymLinks
<Directory "C:/wamp/www/mobile">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
#If you want to allow access from your internal network
# For specific ip addresses add one line per ip address
Allow from 192.168.106.1
# For every ip in the subnet, just use the first 3 numbers of the subnet
#Allow from 192.168.0
</Directory>
</VirtualHost>
Then restart your WAMP server and it works

Directory require all denied not working

I created a virtual host and tried to forbid access to it by using the directory directive with Require all denied.
<VirtualHost *:80>
DocumentRoot /var/www/test
<Directory /var/www/test/>
Require all denied
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
However, the users have still access to every page. How can i solve this?
These directives won't do anything if they're in a VirtualHost not matched by the current request.
Your VirtualHost has no ServerName nor ServerAlias, which is the primary means of having a VirtualHost used for a request.
If you think configuration is being ignored, step is to verify that this VirtualHost is in use. One simply way is to define a unique logfile for the virtual host. Yours does not look unique.
apachectl -S will quickly summarize your virtual hosts.
The Require must not be combined with the deprecated Order, Allow, Deny directives (since Apache 2.4).
Review all the configuration files and replace Order/Allow/Deny with Require, possibly combined using RequireAll, RequireAny, RequireNone.
Note that the configuration is not necesarrily located in the single file holding <VirtualHost>. You need to review all the server configuration files.
E.g. on Ubuntu this includes:
all files in /etc/apache2/sites-enabled
all files in /etc/apache2/conf-enabled
depending on AllowOverride setting you may need to review all the .htaccess files for any directories reachable from the web

Apache VirtualHost from user directory on Amazon EC 2

I'm coming from a non-cloud hosting background on Red Hat Enterprise Linux and/or CentOS and trying to set up an apache (2.2) server with Amazon EC2. I typically host my files from a user's home directory and create a virtualhost like so:
<VirtualHost *:80>
ServerName userdomain.com
DocumentRoot /home/myuser/public_html
<Directory /home/myuser/public_html>
AllowOverride All
<Limit DELETE>
Order Deny,Allow
Deny from All
</Limit>
</Directory>
</VirtualHost>
However on Amazon EC2 that doesn't seem to work at all no matter how I sent the file permissions.
Is this something that just isn't allowed? Do I have to host files from /var/www? What am I missing?
It turns out Linux had SELinux enabled, which I have not encountered before.
The simplest solution was to put it in "permissive" mode as described at
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Enabling_and_Disabling_SELinux-Disabling_SELinux.html

Problems with Apache Virtual Hosts

I have recently just set up a RHEL based server running two domains. However, I am having difficulty hitting both domains from the browser. My config is:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domainA.com
ServerAlias domainA.com *.domainA.com
DocumentRoot /home/domainA/public_html
<Directory "/home/domainA/public_html">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName domainB.com
ServerAlias domainB.com *.domainB.com
DocumentRoot /home/domainB/public_html
<Directory "/home/domainB/public_html">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
The problem is when I navigate to domainA.com I hit the correct Virtualhost (which is fine), however when I navigate to domainB.com it displays the Apache Test page.
Edit
I have a Firewall between the webserver and the web. I tested the rules governing Domain A and Domain B.
Domain A reaches target and a status 200 is returned.
Domain B reaches target and a status 403 (permission denied) is returned
What you need to do is take a look at sites-enabled and sites-available.
Here's the first entry when Googling: http://www.debian-administration.org/articles/412
Looks reasonable and should help you integrate that.
The problem is that you need separate entries for all the sites you want to run on this apache2. Simple entries in your config file don't do it. Only the first works, the rest is more or less ignored. Creating separate entries with sites-enabled and sites-available is the way to go here.

Resources