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

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>

Related

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>

Multiviews on VPS gives me Negotiation error

I'm just started using a VPS and i'm pretty new to Apache and everything.
So i have a few sites up and running, but for some reason i can't get Multiviews to work. I've searched on the internet and found an article that describes my problem, but their solution doesn't work. Also this thread on stackoverflow don't seem to work for me.
I started with the following (site.conf) configuration file in /etc/apache2/sites-availlable
<VirtualHost *:80>
ServerName site.com
DocumentRoot /var/www/vhosts/site.com/webroot/
<Directory /var/www/vhosts/site.com/webroot/>
Options Indexes FollowSymLinks Multiviews
AllowOverride all
</Directory>
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/site_acces.log combined
ErrorLog ${APACHE_LOG_DIR}/site_error.log
</VirtualHost>
Now when i go to www.site.com/index.php it works fine, but www.site.com/index gives me a 404 and the following log message:
[Tue Feb 24 10:18:45 2015] [error] [client 213.125.184.74] Negotiation: discovered file(s) matching request: /var/www/vhosts/site.com/webroot/index (None could be negotiated).
So i changed site.conf to the following:
<VirtualHost *:80>
ServerName site.com
DocumentRoot /var/www/vhosts/site.com/webroot/
<Directory /var/www/vhosts/site.com/webroot/>
Options Indexes +FollowSymLinks -Multiviews
AllowOverride all
</Directory>
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/site_acces.log combined
ErrorLog ${APACHE_LOG_DIR}/site_error.log
</VirtualHost>
Unfortunately, still the same error in my log file, so i disabled the negotiation module (as mentioned), but that just gives me this message:
[Tue Feb 24 10:21:02 2015] [error] [client 213.125.184.74] File does not exist: /var/www/vhosts/site.com/webroot/index
After all my modifications to site.conf i did an service apache2 restart and/or service apache2 reload
At this point i have no clue on how to solve this problem so i hope anyone point me in the right direction.
I think "Options Indexes FollowSymLinks Multiviews" is the correct configuration. And yes, you need do "apache reload" after you modify the configuration.
Also make sure you accept "php" in content Negotiation. (by default it might not accept)

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)

What is wrong with this apache virtualhost directive?

I'm getting 403 forbidden errors with this virtualhost directory in apache 2.2. Can anyone help, please?
<VirtualHost *:80>
ServerName www.xyz.com
ServerAlias xyz.com
DocumentRoot "/home/bruce/projects/links/www"
<Directory />
AllowOverride None
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.htm index.jsp index.php
</VirtualHost>
Thanks!
EDIT error in log is
(13)Permission denied: access to / denied
If i'm not wrong you have indicated the root directory of you file system in < Directory>
It should be:
<VirtualHost *:80>
ServerName www.xyz.com
ServerAlias xyz.com
DocumentRoot "/home/bruce/projects/links/www"
<Directory /home/bruce/projects/links/www>
...
Gah. It ended up being that I was indeed forbidden from accessing that page. I am using a new virtual server provider, and they have set up my /home account as readable only by me. As a result, the user running apache was unable to view the files. I've changed the permissions on my home directory to be more lenient and now everything works as expected.

Adding VirtualHost fails: Access Forbidden Error 403 (XAMPP) (Windows 7)

I've got a XAMPP installation running on Windows 7.
As soon as I add a VirtualHost to httpd-vhosts.conf, BOTH the 'regular' http://localhost AND the new dropbox.local aren't working.
This is what I added to my httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin postmaster#dummy-host.localhost
DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
ServerName dropbox.local
ServerAlias www.dropbox.local
ErrorLog "logs/dropbox.local-error.log"
CustomLog "logs/dropbox.local-access.log" combined
</VirtualHost>
So I looked up my dropbox.local-error.log for any information:
[Thu Feb 02 10:41:57 2012] [error] [client 127.0.0.1] client denied by server configuration: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
This error seems to be solved by adding
<directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
Allow from all
</directory>
But now I get this error in dropbox.local-error.log:
[Thu Feb 02 10:45:56 2012] [error] [client ::1] Directory index forbidden by Options directive: E:/Documenten/Dropbox/Dropbox/dummy-htdocs/
Furthermore when I try to access http://localhost, I dont get any error in the regular error.log, although I get the error 403 when I try to access it.
Can anybody help... It's driving me mad :S
EDIT:
Also in httpd.conf there is the following (I've seen it mentioned multiple times, so before anyone says it):
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
Okay: This is what I did now and it's solved:
My httpd-vhosts.conf looks like this now:
<VirtualHost dropbox.local:80>
DocumentRoot "E:/Documenten/Dropbox/Dropbox/dummy-htdocs"
ServerName dropbox.local
ErrorLog "logs/dropbox.local-error.log"
CustomLog "logs/dropbox.local-access.log" combined
<Directory "E:/Documenten/Dropbox/Dropbox/dummy-htdocs">
# AllowOverride All # Deprecated
# Order Allow,Deny # Deprecated
# Allow from all # Deprecated
# --New way of doing it
Require all granted
</Directory>
</VirtualHost>
First, I saw that it's necessary to have set the <Directory xx:xx> options. So I put the <Directory > [..] </Directory>-part INSIDE the <VirtualHost > [..] </VirtualHost>.
After that, I added AllowOverride AuthConfig Indexes to the <Directory> options.
Now http://localhost also points to the dropbox-virtualhost. So I added dropbox.local to <VirtualHost *:80> which makes it as <VirtualHost dropbox.local:80>
FINALLY it works :D!
I'm a happy man! :) :)
I hope someone else can use this information.
For me worked when I changed "directory" content into this:
<Directory "*YourLocation*">
Options All
AllowOverride All
Require all granted
</Directory>
For me (also XAMPP on Windows 7), this is what worked:
<Directory "C:\projects\myfolder\htdocs">`
AllowOverride All
Require all granted
Options Indexes FollowSymLinks
</Directory>`
It is this line that would cause the 403:
Order allow,deny
I'm using XAMPP 1.6.7 on Windows 7. This article worked for me.
I added the following lines in the file httpd-vhosts.conf at C:/xampp/apache/conf/extra.
I had also uncommented the line # NameVirtualHost *:80
<VirtualHost mysite.dev:80>
DocumentRoot "C:/xampp/htdocs/mysite"
ServerName mysite.dev
ServerAlias mysite.dev
<Directory "C:/xampp/htdocs/mysite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After restarting the apache, it were still not working.
Then I had to follow the step 9 mentioned in the article by editing the file C:/Windows/System32/drivers/etc/hosts.
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 mysite.dev
Then I got working http://mysite.dev
Thank you, that worked! But I replaced this
AllowOverride AuthConfig Indexes
with that
AllowOverride All
Otherwise, the .htaccess didn't work: I got problems with the RewriteEngine and the error message "RewriteEngine not allowed here".
Above suggestions didn't worked for me. I got it running on my windows, using inspiration from
http://butlerccwebdev.net/support/testingserver/vhosts-setup-win.html
For Http inside httpd-vhosts.conf
<Directory "D:/Projects">
AllowOverride All
Require all granted
</Directory>
##Letzgrow
<VirtualHost *:80>
DocumentRoot "D:/Projects/letzgrow"
ServerName letz.dev
ServerAlias letz.dev
</VirtualHost>
For using Https (Open SSL) inside httpd-ssl.conf
<Directory "D:/Projects">
AllowOverride All
Require all granted
</Directory>
##Letzgrow
<VirtualHost *:443>
DocumentRoot "D:/Projects/letzgrow"
ServerName letz.dev
ServerAlias letz.dev
</VirtualHost>
Hope it helps someone !!
After so many changes and tries and answers.
For
SOs: Windows 7 / Windows 10
Xampp Version: Xampp or Xampp portable 7.1.18 / 7.3.7 (control panel v3.2.4)
Installers: win32-7.1.18-0-VC14-installer / xampp-windows-x64-7.3.7-0-VC15-installer
Do not edit other files like httpd-xampp
Stop Apache
Open httpd-vhosts.conf located in **your_xampp_directory**\apache\conf\extra\ (your XAMPP directory might be by default: C:/xampp/htdocs)
Remove hash before the following line (aprox. line 20): NameVirtualHost *:80 (this might be optional)
Add the following virtual hosts at the end of the file, considering your directories paths:
##127.0.0.1
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
##127.0.0.2
<VirtualHost *:80>
DocumentRoot "F:/myapp/htdocs/"
ServerName test1.localhost
ServerAlias www.test1.localhost
ErrorLog "logs/myapp-error.log"
CustomLog "logs/myapp-access.log" common
<Directory "F:/myapp/htdocs/">
#Options All # Deprecated
#AllowOverride All # Deprecated
Require all granted
</Directory>
</VirtualHost>
Edit (with admin access) your host file (located at Windows\System32\drivers\etc, but with the following tip, only one loopback ip for every domain:
127.0.0.1 localhost
127.0.0.2 test1.localhost
127.0.0.2 www.test1.localhost
For every instance, repeat the second block, the first one is the main block only for "default" purposes.
I am using xampp 1.7.3. Using inspiration from here: xampp 1.7.3 upgrade broken virtual hosts access forbidden
INSTEAD OF add <Directory> .. </Directory> in httpd-vhosts.conf, I add it in httpd.conf right after <Directory "D:/xampplite/cgi-bin"> .. </Directory>.
Here is what I add in httpd.conf:
<Directory "D:/CofeeShop">
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory>
And here is what I add in httpd-vhosts.conf
<VirtualHost *:8001>
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "D:/CofeeShop"
ServerName localhost:8001
</VirtualHost>
I also add Listen 8001 in httpd.conf to complete my setting.
Hope it helps
For many it's a permission issue, but for me it turns out the error was brought about by a mistake in the form I was trying to submit. To be specific i had accidentally put a "greater than" sign after the value of "action". So I would suggest you take a second look at your code.