Cannot see contents of directory with local Apache - windows

I have set up apache2 on my Win7 box and would like to be able to see the contents of a directory.
For example, I would like to navigate to:
http://localhost/tutorial/
and see a list the different html, js, and css files I have created. I've already redirected Apache to check the C:\ApacheHtDoc\ folder as the source directory. I've tried looking at folder permissions, but I'm not sure how to see the contents of the C:\ApacheHtDoc\ directory and the subfolders I'm bound to create.

Have you added the directive in Apache2.2\conf\httpd.conf
<Directory "C:\ApacheHtDoc\">
Options Indexes FollowSymLinks
Order Allow,Deny
Allow from All
</Directory>
If you haven't, add that and restart apache.
Edit
Path for the httpd.conf may vary according to your install.

Related

Apache stop webdav directory listing on windows

I'm working on a server which has to serve a few files publically via WebDav. The public availability and WebDav is a must have, so I can't just change them. Windows support (sadly) is another must thing...
It would be great if I could disable directory listing, so the person who I give the webdav link would only be able to either guess the link or use only the one I gave.
In default case it's quite easy to disable directory listing, and in the browser the current configuration perfectly stops dir listing, but when I open it via windows explorer, I can easily see the whole directory and its content. My current config is:
<VirtualHost *>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/web1/web/
<Directory /var/www/web1/web/>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
<LimitExcept GET PROPFIND>
Require valid-user
</LimitExcept>
</Directory>
Alias /v1 /var/www/web1/web
<Location /v1>
DAV On
AuthName "webdav"
</Location>
</VirtualHost>
If I wont allow PROPFIND method, windows thinks that the host is unavailable (unsure if linux can access it, that's not my target).
Is it possible to stop directory listing on windows? For me it seems the PROPFIND is what causes this, but I'm unsure if I can somehow bypass this problem. Do you have any idea how should I modify my config file?
I know this question is old, but in your VirtualHost file (the file in /etc/apache2/sites-available/[yoursite].conf), you need to add something. This is in your directory tag. Supply it with DirectoryIndex disabled. Like this
<Directory [yourdirectory]>
(...)
DirectoryIndex disabled
</Directory>
Sincerly, Chris Fowl

Cannot get site loaded with Apache on Mac

I'm running El Capitan and trying to get my website hosted locally for development with Apache (that came with the OS). I followed the instructions here exactly. I made an anthony.conf file and put the Directory text in there, I replaced the actual directory with /Users/anthony/dev/web/unfinished-asteroids/ and then placed my web files in there. I started apache and navigated for localhost/~anthony but I get the
Not Found: The requested URL /~anthony was not found on this server.
standard 404 error. When I navigate to localhost it works fine and I get the "It works" from the index.html that is located in /Library/WebServer/Documents, I even changed that index.html file and it works fine.
Any ideas why I'm not able to see my website using apache? All I did was download this github repository and place it in my unfinished-asteroids folder, the index.html is at the root.
So it looks like there are a couple of extra steps that you need to do. There isn't really anything too special about apache that comes with OSX, so your standard apache configurations will work. but to get Userdir (~username) working on El Capitan,this is what I had to do
Edit /etc/apache2/httpd.conf
on (or near) line 166, uncomment
loadModule userdir_module libexec/apache2/mod_userdir.so
then on line 493 uncomment
Include /private/etc/apache2/extra/httpd-userdir.conf
then edit file /etc/apache2/extra/httpd-userdir.conf
uncomment line 16
Include /private/etc/apache2/users/*.conf
then in /etc/apache2/users/anthony.conf
<Directory "/Users/anthony/Sites/">
Options Indexes MultiViews
Require all granted
</Directory>
then sudo apachectl restart
That should make http://localhost/~anthony point to your sites directory.
Logs are stored in /var/log/apache2
Now if all you want is web access to say your dev directory you can do something like this.. (don't make any of the changes listed above)
in /etc/apache2/other/ create a file called mydev.conf (name doesn't really matter, save it needs to end in .conf')
and put this in that file
Alias /dev /Users/anthony/dev/
<Directory "/Users/anthony/dev">
Options Indexes MultiViews
Require all granted
</Directory>
and reload apache (sudo apachectl restart)
then you will be able to access your dev folder at http://localhost/dev and should be able to access your page at http://localhost/dev/web/unfinished-asteroids/
you can adjust the paths at will above, just need to make sure that the user or group _www has access to it, and that paths in the alias and the directory match.

Enable directory/file listing in XAMPP

How to enable directory and file listing in XAMPP ? In WAMP it is by default enabled.
My Xampp httpd.conf already had the Indexes option under the xampp directory entry
Removing all the default #comment lines, it looks like this:
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
But, I have my local root mapped to a different directory, outside of 'htdocs', (as per this post Make XAMPP/Apache serve file outside of htdocs ) so to enable this for all directories, I had to find the entry just above that, and add the word "Indexes" to it.
<Directory />
Options FollowSymLinks Indexes
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Note I would never enable this for all directories on a production server, but locally it is quite useful.
Just delete or rename index.html and index.php files
There is a XAMPP Directory Browsing UI app, that will help you to browse projects inside htdocs in XAMPP.
Open apache/conf/httpd.conf and search for Indexes in httpd.conf
And comment complete line like this:
#Options Indexes FollowSymLinks Includes ExecCGI
#Options - Indexes FollowSymLinks Includes ExecCGI
Uncommenting First will enable the indexing of directories.
Uncommenting Second will disable indexing of directories
Removing the comment will enable the Directory/file listing of hosted path.
Rename the 'index.php' file that sits in your htdocs folder to something like 'MODIFIED_index.php' (if you want to be able to revert to it later) - this index.php file is only used to point to xampp's admin controls that are found in 'localhost/xampp/' anyway.

codeigniter localhost setup 404 page not found error

I have a localhost setup(i use apache's virtualhost setup) for a site I am working on with codeigniter. I use SVN for the site.
I decided to change the localhost-domain name and the root-folder name(this is the folder from within which I check out SVN) to which the localhost-domain points.
To show a better picture, I changed;
sledge-vicky.localhost to hammer-vicky.localhost
Changed the document-root's name from "sledge" to "hammer". Have changed the document root,directory paths in the virtualhost setup too;
<VirtualHost hammer-vicky.localhost>
DocumentRoot D:\xampp\htdocs\vicky\projects\hammer
ServerName hammer-vicky.localhost
<Directory "D:\xampp\htdocs\vicky\projects\hammer">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Have set the domain-name in windows' hosts file. Have set/changed the base-url and database settings in config.php and database.php too(I use environment dir; _environment/vicky/config.php, _environment/vicky/database.php ).
In the code where we switch to the required app-environment, I have set the code to switch to my app-environment too.
http://sledge-vicky.localhost/ was working fine.
After the local-domain name and root-folder name change, accessing http://hammer-vicky.localhost/ throws a '404 page not found error'.
Any idea what could be wrong?.
My bad debugging. I got it working. I had to change other settings in some files specific to my environment (in my case, /application/config/_environment/...) that were related to some global settings(which in my case, others sharing the same svn-repository had changed).

Error getting images to show up in Symfony 1.4.8

Note: It was tough deciding whether this belonged here or ServerFault, but it seemed like a programming problem, so if it's out of place, feel free to migrate it.
I downloaded the sandbox of Symfony 1.4.8 and copied the files to my webserver. Unfortunately, when I try to access /symfony/sf_sandbox/web/ (where I installed it), I get the following:
It seems like the images aren't showing. According to the text:
If you see no image in this page, you may need to configure your web server so that it gains access to the symfony_data/web/sf/ directory.
However, when I try to locate the folder referenced above, it does not exist:
sf_sandbox
web
css/
images/
js/
uploads/
frontend_dev.php
index.php
robots.txt
As you can see, there is no sf/ directory under web/. What am I doing wrong?
Note: I am installing this on Ubuntu 10.04 64-bit using Apache.
All the images are located in the Symfony source directory.
I would try creating a symbolic link in the web folder called sf pointed to the following:
lib\vendor\symfony\data\web\sf
It should have access to the needed images at that point.
This is done by indicating the right path in the Alias directive in your apache configuration:
# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080
# This is the configuration for your project
Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
DocumentRoot "/home/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Just replace "/home/sfprojects/jobeet" with your project's path and it should work.
This page shows the apache config to set up a new project correctly.
There are also important security notes for your webapp.
Symfony Documentation
All you need to do is copy the whole sf folder to the web folder. In my case i copied c:\wamp\www\jobeet\lib\vendor\symfony\data\web\sf\ to c:\wamp\www\jobeet\web. Hope that makes sense

Resources