У меня есть два веб-сайта, разработанных с использованием инфраструктуры Django, и я пытался сделать их доступными с одной и той же машины с конфигурацией виртуального хоста в Apache2.
Я создал / etc / apache2 / sites-available / alcs :
NameVirtualHost alcs:80
<VirtualHost alcs:80>
ServerAdmin candini@meeo.it
ServerName alcs
DocumentRoot /home/candini/Repos/ALCS/SW/alcs-system/GUI-User-Interface
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/candini/Repos/ALCS/SW/alcs-system/GUI-User-Interface/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
WSGIScriptAlias / /home/candini/Repos/ALCS/SW/alcs-system/GUI-User-Interface/apache/django.wsgi
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
и / etc / apache2 / sites-available / jsonopenlayers :
NameVirtualHost jsonopenlayers:80
<VirtualHost jsonopenlayers:80>
ServerAdmin candini@meeo.it
ServerName jsonopenlayers
DocumentRoot /home/candini/Repos/CanetaRepo/tmp/STO
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/candini/Repos/CanetaRepo/tmp/STO/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
WSGIScriptAlias / /home/candini/Repos/CanetaRepo/tmp/STO/apache/django.wsgi
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Тогда я сделал следующее:
echo "127.0.0.1 localhost.localdomain localhost jsonopenlayers alcs" >> /etc/hosts
a2ensite alcs
a2ensite jsonopenlayers
/etc/init.d/apache2 reload
/etc/init.d/apache2 restart
Но проблема в том, что я получаю:
root@office-007:~# /etc/init.d/apache2 restart
* Restarting web server apache2 [Mon Dec 12 11:23:26 2011] [warn] NameVirtualHost jsonopenlayers:80 has no VirtualHosts
[Mon Dec 12 11:23:26 2011] [warn] NameVirtualHost jsonopenlayers:80 has no VirtualHosts
... waiting [Mon Dec 12 11:23:27 2011] [warn] NameVirtualHost jsonopenlayers:80 has no VirtualHosts
[Mon Dec 12 11:23:27 2011] [warn] NameVirtualHost jsonopenlayers:80 has no VirtualHosts
Только сайт alcs правильно доступен на http://localhost/alcs. Если я пытаюсь добраться до второго, я получаю следующую ошибку Django:
Page not found (404)
Request Method: GET
Request URL: http://localhost/jsonopenlayers/
Using the URLconf defined in python_scripts.urls, Django tried these URL patterns, in this order:
^alcs/
^alcs/evolution_model_catalogue.html
^alcs/advanced_search_option.html
^alcs/ontological_tree_cascade.html
^alcs/search_evolution_model.html
^alcs/load_evolution_model.json
^alcs/select_load_option.html
^alcs/delete_model.json
^alcs/withdraw_model.json
^alcs/evolution_model_catalogue.html
^alcs/support_request.json
^alcs/malfunction_report.json
^alcs/file_upload.html
^alcs/malfunction_file_upload
The current URL, jsonopenlayers/, didn't match any of these.
Но это работает без проблем, если я удаляю ссылку alcs из каталога / etc / apache2 / sites-enabled / .
Где моя конфигурация неверна?