Utwórz katalog Alias wewnątrz wirtualnego hosta
sprawdziłemtutaj, tutaj, tutaj, tutaj, itutaj przed zadaniem tego pytania. Myślę, że moje umiejętności wyszukiwania są słabe.
UżywamWampServer wersja2.2e
. Mam taką potrzebę, potrzebuję wirtualnej ścieżki wewnątrz wirtualnego hosta. Pozwól, że powiem dwóch gospodarzy, których mam.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/Wamp/www"
</VirtualHost>
Moje aplikacje Wirtualne hosty<VirtualHost *:80>
ServerName apps.ptrl
DocumentRoot "C:/Wamp/vhosts/ptrl/apps"
ErrorLog "logs/apps-ptrl-error.log"
CustomLog "logs/apps-ptrl-access.log" common
<Directory "C:/Wamp/vhosts/ptrl/apps">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.htm index.php
</VirtualHost>
Mój blog Wirtualny host<VirtualHost *:80>
ServerName blog.praveen-kumar.ptrl
DocumentRoot "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"
ErrorLog "logs/praveen-kumar-ptrl-error.log"
CustomLog "logs/praveen-kumar-ptrl-access.log" common
<Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.htm index.php
</VirtualHost>
Moim wymaganiem jest terazhttp://apps.ptrl/blog/
ihttp://blog.praveen-kumar.ptrl/
powinien być tym samym katalogiem. Jedną z rzeczy, o których myślałem, jest poruszanieblog
folder wewnątrzapps
folder, ale jest połączony zGit
i inne rzeczy są tam, więc nie można przenieść folderu.
Więc pomyślałem o stworzeniualias
doVirtualHost
w ten sposób:
<VirtualHost *:80>
ServerName apps.ptrl
DocumentRoot "C:/Wamp/vhosts/ptrl/apps"
ErrorLog "logs/apps-ptrl-error.log"
CustomLog "logs/apps-ptrl-access.log" common
<Directory "C:/Wamp/vhosts/ptrl/apps">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.htm index.php
# The alias to the blog!
Alias /blog "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"
<Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog">
allow from all
order allow,deny
AllowOverride All
</Directory>
</VirtualHost>
Ale kiedy próbowałem uzyskać dostęphttp://apps.ptrl/blog
, DostajęError 403 Forbidden
strona.
Czy robię dobrze? Jeśli chcesz przejrzeć dziennik dostępu i dziennik błędów, są one tutaj:
# Access Log
127.0.0.1 - - [14/Oct/2012:09:53:11 +0530] "GET /blog HTTP/1.1" 403 206
127.0.0.1 - - [14/Oct/2012:09:53:11 +0530] "GET /favicon.ico HTTP/1.1" 404 209
127.0.0.1 - - [14/Oct/2012:09:53:53 +0530] "GET / HTTP/1.1" 200 6935
127.0.0.1 - - [14/Oct/2012:09:53:53 +0530] "GET /app/blog/thumb.png HTTP/1.1" 404 216
# Error Log
[Sun Oct 14 09:53:11 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/Wamp/vhosts/ptrl/praveen-kumar/blog
[Sun Oct 14 09:53:11 2012] [error] [client 127.0.0.1] File does not exist: C:/Wamp/vhosts/ptrl/apps/favicon.ico
[Sun Oct 14 09:53:53 2012] [error] [client 127.0.0.1] File does not exist: C:/Wamp/vhosts/ptrl/apps/app/blog, referer: http://apps.ptrl/
Czekam z niecierpliwością na pomoc. Jestem gotowy dostarczyć więcej informacji, jeśli to konieczne.
Aktualizacja # 1: Zmieniono deklarację VirtualHosts zgodnie z instrukcjami podanymi przezfelipsmartins:<VirtualHost *:80>
ServerName apps.ptrl
DocumentRoot "C:/Wamp/vhosts/ptrl/apps"
ErrorLog "logs/apps-ptrl-error.log"
CustomLog "logs/apps-ptrl-access.log" common
# The alias to the blog!
Alias /blog "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"
<Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog">
allow from all
order allow,deny
AllowOverride All
</Directory>
<Directory "C:/Wamp/vhosts/ptrl/apps">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.htm index.php
</VirtualHost>
Aktualizacja 2: Kolejny problem:Jestem w stanie uzyskać dostęp do witryny. Fizyczne łącza działają teraz. tj. jestem w stanie otworzyćhttp://apps.ptrl/blog/index.php
ale niehttp://apps.ptrl/blog/view-1.ptf
, które zostanie przetłumaczone nahttp://apps.ptrl/blog/index.php?page=view&id=1
. Jakieś rozwiązania?