Reputation: 31252
I have created a simple php file sample.php
under /var/www/project/dummy/test/sample.php
Here is the httpd.conf
Listen 8080
<VirtualHost *:8080>
ServerName example.com
DocumentRoot "/var/www/projects/dummy/test"
<Directory "/var/www/projects/dummy/test">
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
Here is the sample.php
(just checking if memcache is enabled)
<? php
if(class_exists('Memcache')){
echo "found";
}
?>
when I access localhost:8080/sample.php
or localhost:8080/test/sample.php
, I get 404 error
. I am unable to figure out what is going wrong.
I am concerned why localhost
if failing.
To add to that, even www.example.com/sample.php
is failing.
Thanks for help
P.S: I have mapped ip address in /etc/hosts
as follows:
127.0.0.1 example.com www.example.com localhost
why is localhost
failing?
Upvotes: 4
Views: 1931
Reputation: 1509
The document root in httpd.conf is /var/www/projects/dummy/test
, however you said the files were located at /var/www/project/dummy/test/sample.php
. Note "project" is singular in one and plural in the other. This would cause 404's.
The Apache logs are also a good place to start when debugging 404's. I'm not sure which OS you're running, but on Ubuntu they can be found at /var/log/apache2/error.log
.
Upvotes: 1