index.php files ignored

Tony Miller tmiller at thehawkeye.com
Sat Mar 19 16:34:09 PDT 2011


Ryan,

On Mar 19, 2011, at 5:16 PM, Ryan Schmidt wrote:

> Let's keep the discussion on the mailing list, so all can benefit from it. (Use Reply All when you reply.)

Sorry, will do. Didn't know that. 

> 
> 
> On Mar 19, 2011, at 11:52, Tony Miller wrote:
> 
>> On Mar 19, 2011, at 2:08 AM, Ryan Schmidt wrote:
>> 
>>> On Mar 18, 2011, at 13:08, Tony Miller wrote:
>>> 
>>>> If I try to load the site using the DNS name for the site, ex: http://www.mysite.com/ it fails to acknowledge there is an index.php file in the root of the directory and redirects to the default site for the apache server.
>>> 
>>> It redirects?
>>> What *exactly* does the server return? what headers? In the Terminal, do this:
>>> 
>>> curl -I http://www.mysite.com/
>>> 
>>> (P.S: capital I, not lowercase l)
>> 
>> I guess 'redirect' is the wrong term. It is really just going to the default virtual host on the server because it is not finding the index.php file. 
> 
> I agree it's probably using a different virtual host, but not because it's not finding the index.php file. Virtual hosts are independent environments. Apache does not decide, when it cannot find a file in one virtual host, to go looking for it in another.

My understanding is apache will use the default virtual host for the server if it can't find a defined DirectoryIndex file. 

> 
> 
>> web5:leopoldheritage systems$ ls -ls
>> total 56
>> 8 -rwxrwxr-x   1 systems  _www  2073 Mar  9 20:43 INSTALL
>> 8 -rwxrwxr-x   1 systems  _www  1085 Mar  9 20:43 LICENSE.TXT
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:42 blocks
>> 0 drwxrwxr-x  22 systems  _www   748 Mar  9 20:42 concrete
>> 0 drwxrwxr-x   4 systems  _www   136 Mar  9 20:42 config
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:42 controllers
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:42 css
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:42 elements
>> 0 drwxrwxr-x  15 systems  _www   510 Mar  9 20:43 files
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 helpers
>> 8 -rw-r--r--@  1 systems  _www   122 Mar 14 10:03 index.html
>> 8 -rw-r--r--@  1 systems  _www    42 Mar 18 16:35 index.php
>> 8 -rwxrwxr-x@  1 systems  _www    42 Mar 18 16:34 indexnot.php
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 jobs
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 js
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 languages
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 libraries
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 mail
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 models
>> 0 drwxrwxr-x  12 systems  _www   408 Mar  9 20:43 packages
>> 8 -rw-rw-r--   1 systems  _www   269 Feb 27 21:22 phplocal.php
>> 8 -rwxrwxr-x   1 systems  _www   347 Mar  9 20:43 robots.txt
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 single_pages
>> 0 -rwxrwxr-x   1 systems  _www     0 Mar  9 20:43 sitemap.xml
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 themes
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 tools
>> 0 drwxrwxr-x   2 systems  _www    68 Mar  9 20:43 updates
> 
> What is the full path to this directory?

/opt/local/apache2/htdocs/leopoldheritage
> 
> 
>> web5:leopoldheritage systems$ curl -I http://www5.leopoldheritage.org
>> HTTP/1.1 200 OK
>> Date: Sat, 19 Mar 2011 16:49:02 GMT
>> Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/1.0.0d DAV/2 PHP/5.3.5
>> Last-Modified: Mon, 07 Mar 2011 21:08:19 GMT
>> ETag: "8f-49deae52296c0"
>> Accept-Ranges: bytes
>> Content-Length: 143
>> Content-Type: text/html
>> 
>> web5:leopoldheritage systems$ curl -I http://www5.leopoldheritage.org/index.php
>> HTTP/1.1 404 Not Found
>> Date: Sat, 19 Mar 2011 16:49:20 GMT
>> Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/1.0.0d DAV/2 PHP/5.3.5
>> Content-Type: text/html; charset=iso-8859-1
>> 
>> The file is clearly in the directory, but it doesn't find it. 
> 
> I guess the virtual host is not set up correctly. Could you show the Apache virtual host definition for www5.leopoldheritage.org?

<VirtualHost 69.18.41.175:80>
  ServerName www5.leopoldheritage.org
  ServerAlias www5.leopoldheritage.org
  DocumentRoot "/opt/local/apache2/htdocs/leopoldheritage"
  DirectoryIndex index.php
  ErrorLog "logs/web5.thehawkeye.com-error_log"
  CustomLog "logs/web5.thehawkeye.com-access_log" common
	<IfModule mod_ssl.c>
		SSLEngine Off
		SSLCertificateFile "/etc/certificates/Default.crt"
		SSLCertificateKeyFile "/etc/certificates/Default.key"
        SSLProtocol all -SSLv2
        SSLCipherSuite "ALL:!ADH:RC4+RSA:+HIGH:!MEDIUM:!LOW:!SSLv2:!EXP"
	</IfModule>
	<IfModule mod_dav.c>
		DAVLockDB "/var/run/davlocks/.davlock100"
		DAVMinTimeout 600
	</IfModule>
	<IfModule mod_mem_cache.c>
		CacheEnable mem /
		MCacheSize 4096
	</IfModule>
	<Directory "/opt/local/apache2/htdocs/web5">
        AllowOverride None
		<IfModule mod_dav.c>
			DAV Off
		</IfModule>
		Options All -Includes -ExecCGI +MultiViews -Indexes
	</Directory>
	<IfModule mime_module>
	  AddType html/text	php
	  AddType application/x-httpd-php	php
	  AddType application/x-httpd-php-source	phps
	</IfModule>
  <IfModule mod_rewrite.c>
		RewriteEngine On
		RewriteCond %{REQUEST_METHOD} ^TRACE
		RewriteRule .* - [F]
	</IfModule>
</VirtualHost>

> 
> 

I have a couple other virtual domains on this server, including a couple that are using SSL on port 443, that use index.html and index.tpl and default.tpl DirectoryIndex files and they are working fine. 



More information about the macports-users mailing list