[英]How config apache in Django1.8 and PHP in server Debian
我正在嘗試使用Django和PHP創建本地服務器,並且希望可以在其他計算機上進行訪問。 我正在嘗試創建兩個文件夾,一個名為Django的Django文件,另一個名為PHP的PHP文件。 我是apache的初學者,直到現在我只做這個:
/etc/apache2/sites-available/etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
WSGIScriptAlias / /var/www/wsgi_test/app.wsgi
<Directory /var/www/wsgi_test/>
Require all granted
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
app.wsgi:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
我可以訪問我的本地主機(10.1.1.20),以及其他計算機上的任何子域,例如:10.1.1.20/無論打開“ Hello World”文件,但我想訪問我的文件夾django,但是它顯示“ Hello World”
//更新
我用以下答案解決: Django和PHP一起在服務器中,只有一個IP和端口
您正在將hello world wsgi文件指定為WSGI文件。 您將必須使用django wsgi文件才能訪問django。
可以在項目目錄下找到該文件,名稱為project_name/wsgi.py
(即與項目設置位於同一文件夾中)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.