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.
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>
I have a wordpress site, Because wordpress need .htaccess rule, so /var/www/html should be set AllowOverride all. But I have some custom folder /var/www/html/temp/, it has many sub-folder, the max depth could be 9. /var/www/html/temp/images/avatar/username/large/cache/image.jpeg. How to add another rule, so that <directory "/var/www/html/temp"> could be with rule AllowOverride None,thanks.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
There's not really a trick here, if you create a 2nd directory section that is conceptually below the first, its changes will be merged in:
<Directory "/var/www/html/temp">
AllowOverride None
</Directory>
For clarity, just put it immediately after the existing Directory section, although for Directory that is not strictly necessary.
You should review the basics of the "configuration sections" topic in the manual.
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>
I'm working on 2 different sites. I have local copies of them checked out from SVN at my home folder, and symbolic links in /var/www pointing to them.
I've set up virtual hosts in httpd.conf like this:
<VirtualHost *:80>
DocumentRoot /var/www/siteA
ServerName 192.168.0.10/siteA
<Directory "/var/www/siteA">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/siteB
ServerName 192.168.0.10/siteB
<Directory "/var/www/siteB">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I would like to be able to access the sites with 192.168.0.10/siteA and /siteB, but when typing the address in browser, it throws a 404 and apache error log says: "File does not exist: /var/www/siteA/siteA".
What am I doing wrong and where does the second "/siteA" come from?
You've got too much configuration in there. /SiteA and /SiteB should be paths relative to your site root, you can't have different sites on the same host header, which in this case is "192.168.0.10". If you want to bind that address to the configuration, something along the lines of the following should work.
<VirtualHost 192.168.0.10:80>
DocumentRoot /var/www
ServerName 192.168.0.10
<Directory "/var/www">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
If you now browse to /SiteA, /SiteB you should see the contents of your directory as long as your symlinks are correct. You also need to ensure you have the "NameVirtualHost" directive set correctly in your httpd.conf.