I am running Ubuntu 13.10 with Apache 2.4 and i want to make a folder which will contain all my PHP files that I am making for testing purposes. I created a Vhost for the folder and it works when i target the sepcific file in mind, in example :
http:/phptestsite/some_random_php_script.php
When i go there the code (if it works ;) ) will execute, but I want to create a list of all php files (similar to that of a ftp site/listing) when i go to
http:/phptestsite/
So that i do not have to manually type in everytime each individual php script I want to test, but just go to that vhost and click on the file.php I want to test.
Vhost conf:
<VirtualHost *:80>
DocumentRoot /home/usrnname/PHPTest/
ServerName phptest
ServerAlias phptest
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/username/PHPTest/>
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
you should add Options +Indexes to list the directories
<Directory /home/username/PHPTest/>
Options FollowSymLinks MultiViews +Indexes
AllowOverride All
Require all granted
</Directory>
Related
I am trying to get my .htaccess working on my Ubuntu-apache2-webserver.
For that I opened /etc/apache2/apache2.conf,
I removed the comment sign (#) before AccessFileName .htaccess
and replaced AllowOverride None by AllowOverride All in
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I activated mod_rewrite via a2enmod rewrite and restarted the server.
But each time I am performing those changes and open an html-file placed inside of /var/www/html, I get a 500 Internal Server Error for Virtual Host 80.
The same thing happened to me when placing
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
before </VirtualHost> into the 000-default.conf-file instead of the /etc/apache2/apache2.conf.
Can anyone tell me what I am missing?
You're slightly off in your syntax for allowOverride. The Directory tag needs to be inside the VirtualHost tag. Like so:
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog /var/log/apache2/error.log
Options Includes
<Directory "/var/www/html">
AllowOverride All
</Directory>
</VirtualHost>
Also, make sure Apache has permissions to read and write to the directory /var/www/html
Hi installed wordpress as localhost on my machine. I wanted to access it from another machine on my LAN. I can access the page. But non of the images or css is applying, Looking in firebug it's riddled with 404 errors to all the files it required. the path specifies the IP and not Localhost and exist in their locations.
I am trying to set apache to allow file browsing via the website I have set HTTPD.CONF and .htaccess but cant get file browsing the site is located at c:\xampp\apache\htdocs
heres what I have in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
AllowOverride all
Require all granted
</Directory>
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "/wordpress">
AllowOverride all
Require all granted
Options Indexes FollowSymLinks
</Directory>
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/wordpress/index.php"
ServerName wordpress
</VirtualHost>
in .htaccess
Options +Indexes
the error.log doesn't contain anything that stands out to me
You have to specify the option +Indexes in the corresponding Directory:
<Directory "C:/xampp/apache/htdocs">
Options +Indexes
</Directory>
How do I configure Apache2 to load a page with the extensions of default files provided when a page is requested without an extension.
So for example I want http://webpage.com/page to automatically load either:
http://webpage.com/page.html OR
http://webpage.com/page.php
NOTE: I don't want any redirection or URL renaming to occur; meaning I want the address bar to still be showing http://webpage.com/page
Per CBroe's comments and his reference to apache docs httpd.apache.org/docs/2.2/content-negotiation.html#multiviews - Adding Multiviews to Options directive inside a Directory section solves this issue.
You can either add it to a Directory section like below (to affect all web applications under sites directory)
<Directory /sites>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
-OR- inside a site host definition
<VirtualHost *:80> #site.dev
ServerAdmin admin#email.com
ServerName site.dev
ServerAlias site.dev
DocumentRoot /sites/site.dev
<Directory /sites/site.dev>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
I have the following website structure
/var/www/
|
|--> home/
|
|--> index.html
in /etc/apache2/sites-enables/000-default the http virtual host is so configured
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
Redirect permanent / https://192.168.17.73/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
When I go to 192.168.17.73/home/index.html I'm correctly redirected to https://192.168.17.73/home/index.html.
However, when I type, 192.168.17.73/home/ the redirection brings me to https://192.168.17.73/home/home/, which doesn't exist.
This ended to be a problem caused by a gedit preference to create a backup copy and autosave the files.
Solution. After disabling those two features, I deleted any file like httpd.conf.save or httpd.conf~ and all worked fine.
I installed Moveable type on a ubuntu box.
The admin section works great.
However the front page does not. The images and CSS are not displayed.
This is coming from the apache error log:
Permission denied: exec of '/var/www/mt/example/styles.css' failed
Premature end of script headers: styles.css
I think it's related to my apache config. Since i call the admin section using the localhost, but i use the example.com for the front page, which is the part that doesnt work.
This is my apache config:
NameVirtualHost *
<VirtualHost *>
ServerAdmin chris#example.com
ServerName mt.example.net
DocumentRoot /var/www/mt
Alias /mt-static /var/www/mt/mt-static
<Directory /var/www/mt/mt-static>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias / /var/www/mt/
<Directory /var/www/mt>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerAdmin chris#example.com
ServerName example.com
ServerAlias example.com www. example.com
DocumentRoot /var/www/example
Alias /mt-static /var/www/mt/mt-static
<Directory /var/www/mt/mt-static>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Redirect /mt.cgi http://mt.example.net/mt.cgi
</VirtualHost>
it because the directory where the css file is located (var/www/mt/example/) is a sub-directory of one which is declared to be a script in (/var/www/mt) with Options +ExecCGI
Directories inherit the options of their parents
It sounds like Apache has tried to run the .css file as an executable. The only thing which I can suggest is that you might have a css file which has an executable permission, for some reason, so Apache tries to execute it. Try
chmod a-x
on the CSS file and see if it makes a difference.
Sometimes files copied from Windows have executable set when they shouldn't.