Virtual Host Apache2 (Ubuntu 14.04)
I'm trying to set up a VH on apache2 so i've created the file "mysite.conf" like this
<Virtual Host *:80>
ServerName mysite.net
ServerAlias www.mysite.net
ServerAdmin webmaster@mysite.net
DocumentRoot /var/www/webmaster_home
ErrorLog [...]
CustomLog [...]
</VirtualHost>
and all works fine untill I decided to move my site in a new dir named "mysite.net". So I modified my "mysite.conf":
<Virtual Host *:80>
ServerName mysite.net
ServerAlias www.mysite.net
ServerAdmin webmaster@mysite.net
DocumentRoot /var/www/webmaster_home/mysite.net
ErrorLog [...]
CustomLog [...]
</VirtualHost>
and my site stop works. The log file reported:
AH00124: Request exceeded the limit of 10 internal redirects due to probable configuartion error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
AH00121: r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /var/www/webmaster_home/index.php
AH00122: redirected from r->uri = /index.php
After Googling my problem it results in an error of my "mysite.conf", wich should include:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/webmaster_home>
Options -Indexes -FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Done that I tried again and a new error came out reporting
You don't have permission to access / on this server.
and looking at the log file it reports:
AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are bot off, so the
RewriteRule directive is also forbidden due to its similar ability to
circumvent directory restrictions
So if I set up FollowSymLinks or SymLinksIfOwnerMatch I get a loop, if I don't my user can't access the directory.
If it will be useful, this is my "apache2.conf"
<Directory />
Options FollowSymLink
AllowOverride None
</Directory>
<Directory var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
And my /var/www/webmaster_home/.htaccess
<ifModule mod_rewrite.c>
<ifModule mod_negotiation.c>
Options -MultiViews
</ifModule>
RewriteEngine On
##
## You may need to uncomment the following line for some hosting enviroments,
## if you have installed to a subdirectory, enter the name here also.
##
# RewriteBase /
##
## Black liste protected files
##
RewriteRule themes/.*/(layouts|pages|partials)/.*.htm index.php [L,NC]
RewriteRule uploads/protected/.* index.php [L,NC]
##
## White listed folders and files
##
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !.js
RewriteCond %{REQUEST_URI} !.ico
RewriteCond %{REQUEST_URI} !.jpg
RewriteCond %{REQUEST_URI} !.jpeg
RewriteCond %{REQUEST_URI} !.gif
RewriteCond %{REQUEST_URI} !.css
RewriteCond %{REQUEST_URI} !.less
RewriteCond %{REQUEST_URI} !.scss
RewriteCond %{REQUEST_URI} !.pdf
RewriteCond %{REQUEST_URI} !.png
RewriteCond %{REQUEST_URI} !.swf
RewriteCond %{REQUEST_URI} !.txt
RewriteCond %{REQUEST_URI} !.xml
RewriteCond %{REQUEST_URI} !.xls
RewriteCond %{REQUEST_URI} !.eot
RewriteCond %{REQUEST_URI} !.woff
RewriteCond %{REQUEST_URI} !.ttf
RewriteCond %{REQUEST_URI} !.svg
RewriteCond %{REQUEST_URI} !.wmv
RewriteCond %{REQUEST_URI} !.avi
RewriteCond %{REQUEST_URI} !.mov
RewriteCond %{REQUEST_URI} !.mp4
RewriteCond %{REQUEST_URI} !.webm
RewriteCond %{REQUEST_URI} !.ogg
RewriteCond %{REQUEST_URI} !docs/.*
RewriteCond %{REQUEST_URI} !themes/.*
RewriteCOnd ^ index.php [L,NC]
##
## Standard routes
##
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</ifModule>
And this is my directories tree:
/var
|----www/
|----webmaster_home/
|----mysite.net/
|----logs/
Well, I solved this by moving .htaccess in mysite.net/ from webmaster_home/
When I moved entire sito from previous dir the hidden files weren't moved with the rest of the files.
上一篇: 在主目录中设置虚拟主机