Vagrant + Puppet + Apache : 403 error - apache

I have a problem with Apache, using Vagrant and Puppet.
With Vagrant, I mount my app folder like this :
config.vm.synced_folder "./../", "/home/vagrant/myapp/", id: "myapp-sources", :owner => "root", :group => "root"
With I provision my vhost with puppet. It looks like this :
<VirtualHost *:80>
ServerAdmin webmaster#myapp
DocumentRoot /home/vagrant/myapp/web
DirectoryIndex index.php index.html index.htm
ServerName myapp.vagrant
ServerAlias myapp.vagrant *.myapp.vagrant
ErrorLog /var/log/apache2/myapp-error_log
CustomLog /var/log/apache2/myapp-access_log common
<Directory /home/vagrant/myapp/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
When I access myapp.vagrant from my browser (I modified my /etc/hosts) I get a 403 error. In /var/log/apache2/myapp-error_log, I read this :
[Tue Dec 31 10:33:00.841882 2013] [authz_core:error] [pid 998] [client 192.168.33.1:55878] AH01630: client denied by server configuration: /home/vagrant/myapp/web/
I have no .htaccess file in my web folder.
I don't know where to look to solve this.
By the way, accessing my VM via it's IP in my browser shows the Apache "It works !" page in /var/www (user root, group root) and I have a virtual host to redirect myapp.vagrant:8000 to /usr/share/phpmyadmin (user root, group root) and it works fine.

Are you by any chance using Apache 2.4? A simple search revealed it is likely a new permission model that's causing grief: http://dabase.com/blog/AH01630:_client_denied_by_server_configuration/

Related

Cannot serve directory /var/www/html/: No matching DirectoryIndex

I'm sure this question has been asked and answered, but I'm not finding a solution. I have a virtual host I have just added SSL to, and it isns't working as expected. The non-SSL version is working properly. Below is what I've got in httpd.conf:
<VirtualHost mysite.com:443>
ServerAdmin email#myemail.com
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /var/www/html/www.mysite.com
<Directory /var/www/html/www.mysite.com>
DirectoryIndex index.html index.htm index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/my.crt
SSLCertificateKeyFile /etc/pki/tls/private/my.key
</VirtualHost>
The error I'm getting is:
[Thu Jan 11 12:29:58.984354 2018] [autoindex:error] [pid 19998] [client
IP:38470] AH01276: Cannot serve directory /var/www/html/: No matching
DirectoryIndex (index.html,index.php) found, and server-generated directory
index forbidden by Options directive
Obviously, I've got the directory set as /var/www/html/www.mysite.com, but it's trying to serve content directly from /var/www/html.
I'm sure this is something simple, but my brain is already oatmeal from working on this site all day, so I'm probably just failing to see what's right in front of my face.
Thanks!
Fixed it. Simple enough, as I assumed. Change:
<VirtualHost mysite.com:443>
To:
<VirtualHost *:443>

apache + symlinks = 403

So I've been reading up a lot on the subject but can't figure out what I'm doing wrong, I also tried a couple solutions found here but still...
I have multilple vhosts set up with Apache, everything working fine serving different files from both /home/usr1/html and /home/usr2/html.
Now I symlinked /home/usr1/html/thisfolder to /home/usr2/html/thatfolder, double checked the FollowSymlinks option is enabled both in apache2.conf and in vhost.conf, but I'm getting a 403 Error.
Why should this be about permits? I mean, www-data can read without any problem from both folders, how is it that when symlinked it just doesn't?
Thanks
EDIT:
Error returned by Apache: (notice the missing script filename, only extension is provided)
[Wed Apr 20 12:13:11.297208 2016] [authz_core:error] [pid 19883] [client 192.168.0.1:12345] AH01630: client denied by server configuration: /home/usr2/html/thatfolder/.php
Virtual Host conf file:
<VirtualHost *:80>
ServerName server.domain.lan
ServerAdmin adm#lan
DocumentRoot /home/usr2/html
<Directory /home/usr2/html>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/usr1/html/thisfolder> // original folder
Require all granted
</Directory>
</VirtualHost>

Apache redirecting to removed virtual host

I have a strange issue with my Apache. I added a new virtual host and I noticed if I browse to it it redirects to another hosts home directory. I have host1, host2 and newly created host3. If I browse to address for host 3 it would take me to host1 site.
I removed host1 now but it still trying to take me to host1 (Apache log has"
[Thu Jul 24 16:31:33 2014] [error] [client 127.0.0.1] File does not exist: C:/WWW/htdocs/public/host1/index.html " which is home directory for host1 site which is removed from httpd.conf. Apache service restarted, all other .conf files checked - no mentioning of host1.
here how its configured:
################# host2 ############################
<VirtualHost host2.net:80>
DocumentRoot "C:/WWW/htdocs/host2/public/"
ServerName host2
ServerAlias host2.local
<Directory "C:/WWW/htdocs/host2/public/">
Options Indexes FollowSymLinks
DirectoryIndex index.php index.html
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
################# host3 ############################
<VirtualHost host3.net:80>
DocumentRoot "C:/WWW/htdocs/host3/public/"
ServerName host3
ServerAlias host3.local
<Directory "C:/WWW/htdocs/host3/public/">
Options Indexes FollowSymLinks
DirectoryIndex index.php index.html
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Thanks
In case anybody have the same issue - I just found one software on my PC that has been messing with port 80. Once that software removed - my apache works fine

WAMP Using PostgreSQL + Drupal 7 + Multisite + CleanURLs - Not working

As the title suggests I am trying to run multiple local development sites on WAMP using Postgresql...I have tried so many combinations and none work.
I have 3 sites that correspond to live productions sites so clean-urls is key...
site1.example.com
site2.example.com
site3.example.com
I installed Drupal7 in a local folder on my harddrive at c:\CM\Web\fooproject
I created a hard-link in WAMP at c:\wamp\www\fooproject to c:\CM\Web\fooproject
I edited "sites.php" in the drupal fooproject\sites directory to look like below:
$sites['localhost.site1.example.com'] = 'site1.example.com';
$sites['localhost.site2.example.com'] = 'site2.example.com';
$sites['localhost.site3.example.com'] = 'site3.example.com';
I added the following to my local PCs hosts file:
127.0.0.1 localhost.site1.example.com
127.0.0.1 localhost.site2.example.com
127.0.0.1 localhost.site3.example.com
I connect to the sites in the browser, e.g. - for site1 at:
"http://localhost/site1.example.com"
I created a database in PostgreSQL called "site1drupal"
I enabled the rewrite module in WAMP
Alias /site1.example.com "c:/wamp/www/fooproject/"
<Directory "c:/wamp/www/fooproject/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
I edited the ".htaccess" file in the drupal directory c:/wamp/www/fooproject/ to rewrite the base directory as follows:
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
RewriteBase /fooproject
I edited the httpd.conf file on WAMP Apache --> http.conf to include the Virtual hosts directory:
<VirtualHost *:80>
ServerAdmin site1#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site1.example.com
ServerAlias localhost.site1.example.com
ErrorLog "c:/wamp/logs/site1-error.log"
CustomLog "c:/wamp/logs/site1-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin site2#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site2.example.com
ServerAlias localhost.site2.example.com
ErrorLog "c:/wamp/logs/site2-error.log"
CustomLog "c:/wamp/logs/site2-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin site1#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site1.example.com
ServerAlias localhost.site1.example.com
ErrorLog "c:/wamp/logs/site1-error.log"
CustomLog "c:/wamp/logs/site1-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin site3#dummy-host.example.com
DocumentRoot "c:/wamp/www/fooproject/"
ServerName site3.example.com
ServerAlias localhost.site3.example.com
ErrorLog "c:/wamp/logs/site3-error.log"
CustomLog "c:/wamp/logs/site3-access.log" common
</VirtualHost>
I copied the "default" folder in the sites directory and created 3 new folders called "site1.example.com", "site2.example.com" and "site3.example.com"
I am able to install the site fine and navigate to localhost/site1.example.com/?q=admin/config/search/clean-urls and enable clean urls
BUT the result is that it takes me to an "Internal Server error" page if I click link outside of the homepage :(
The error log says the following:
[Thu Feb 13 17:56:14.108803 2014] [core:error] [pid 5268:tid 1636] [client 127.0.0.1:57100] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://localhost/site1.example.com/
[Thu Feb 13 17:56:14.109805 2014] [core:debug] [pid 5268:tid 1636] core.c(3518): [client 127.0.0.1:57100] AH00122: redirected from r->uri = /site1.example.com/admin/config, referer: http://localhost/site1.example.com/
I am sure it is a simple fix but I just can't see it ..too many moving parts. Any help would be appreciated :D
Okay I figured this out ...
1st) I needed to remove the aliases I created using WAMP because they were only good if I had multiple INSTALLS of drupal (like testing different versions) ..have nothing to do with Multiple sites!
2) You set-up Vhosts for each site using the actual site name... e.g.
ServerName = site1.example.com
3) You edit the sites.php file to link what you put in your web-browser (localhost.site1.mwdworks.com => site1.mwdworks.com)
4) You add in your computer hosts file the site name you will put in the web-browser (for local development purposes - this can be any name as long as it matches what you put in sites.php ...)
e.g.
127.0.0.1 localhost.site1.example.com
and viola ...this all works well ...just follows these instructions and you are good)

Apache virtualhost 403

I'm stuck on this 403 problem. I set up virtual host for apache on ubuntu, and when I access the site, it returns 403.
/etc/apache2/site-available/os.solesschong.com
<VirtualHost *>
DocumentRoot /root/mysoft/sns
ServerName oa.solesschong.com
ErrorLog ${APACHE_LOG_DIR}/oa.solesschong.com-error.log
CustomLog ${APACHE_LOG_DIR}/oa.solesschong.com-access.log combined
<Directory /root/mysoft/sns>
Allow from all
</Directory>
</VirtualHost>
# a2enable oa.solesschong.com
file
root/mysoft/sns/index.php
DNS
oa.solesschong.com A-record: [IP of my server]
browser return
Forbidden
You don't have permission to access / on this server.
Apache/2.2.22 (Ubuntu) Server at oa.solesschong.com Port 80
Does the Apache process have permission access to read to /root/mysoft/sns/index.php?
Check your version of apache. If it is 2.4 then you need change alow configuration from
Allow from all
to
Require all granted