Python apache2服务器上使用wsgi的两个Django应用程序?
我试图在Apache2服务器上部署两个Django应用程序,运行在Ubuntu-16.04上。我的000-default.conf文件如下所示: 更新:(不同端口) 我使用的IP是172.16.16.68 当我运行单个应用程序pep_web时,我可以通过浏览器连接此应用程序Python apache2服务器上使用wsgi的两个Django应用程序?,python,django,django-forms,apache2,django-wsgi,Python,Django,Django Forms,Apache2,Django Wsgi,我试图在Apache2服务器上部署两个Django应用程序,运行在Ubuntu-16.04上。我的000-default.conf文件如下所示: 更新:(不同端口) 我使用的IP是172.16.16.68 当我运行单个应用程序pep_web时,我可以通过浏览器连接此应用程序 172.16.16.68/pep_learn 而对于MyApp,则可以通过这样的浏览器 172.16.16/MyApp <VirtualHost *:80> <Directory /home/b
172.16.16.68/pep_learn
而对于MyApp,则可以通过这样的浏览器
172.16.16/MyApp
<VirtualHost *:80>
<Directory /home/bic/MyApp/MyApp>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess MyApp python-path=/home/bic/MyApp:/usr/lib/python2.7/dist-packages
WSGIProcessGroup MyApp
WSGIScriptAlias /MyApp /home/bic/MyApp/MyApp/wsgi.py
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:8080>
Alias /static /home/bic/pep_web/protocol/static
<Directory /home/bic/pep_web/protocol/static>
Require all granted
</Directory>
<Directory /home/bic/pep_web/pep_learn>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess pep_web python-path=/home/bic/pep_web:/usr/lib/python2.7/dist-packages
WSGIProcessGroup pep_web
WSGIScriptAlias /pep_learn /home/bic/pep_web/pep_learn/wsgi.py
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
要求所有授权
WSGIDaemonProcess MyApp python path=/home/bic/MyApp:/usr/lib/python2.7/dist-packages
WSGIProcessGroup MyApp
WSGIScriptAlias/MyApp/home/bic/MyApp/MyApp/wsgi.py
服务器管理员webmaster@localhost
DocumentRoot/var/www/html
别名/static/home/bic/pep_web/protocol/static
要求所有授权
要求所有授权
WSGIDaemonProcess pep_web python path=/home/bic/pep_web:/usr/lib/python2.7/dist-packages
WSGIProcessGroup pep_网站
WSGIScriptAlias/pep_learn/home/bic/pep_web/pep_learn/wsgi.py
服务器管理员webmaster@localhost
DocumentRoot/var/www/html
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
通过此设置,“MyApp”正在工作,但另一个应用程序“pep_web”不工作。我怎样才能解决这个问题 因为两者都在同一端口运行
80
。您需要在每个VirtualHost
更多
@itzMEonTVTV感谢您的建议,因为我对服务器和apache非常陌生,您能解释一下我如何给不同的服务器命名,因为我只使用一个IP来承载两个站点,而没有任何域名。如果您不使用域,请在不同的端口运行。如果您在本地主机上工作,并在同一主机上访问,我想您可以在/etc/hosts/i中使用不同的端口80和8080来指定本地域,但给出的错误相同。您可以用您提供的“/etc/hosts”示例修改上面的“.conf”脚本吗。这将帮助我正确理解这个概念。我已经看过很多关于这方面的帖子,并且尝试了所有的方法,但都没有效果。请更新你为不同端口尝试的.conf
<VirtualHost *:80>
<Directory /home/bic/MyApp/MyApp>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess MyApp python-path=/home/bic/MyApp:/usr/lib/python2.7/dist-packages
WSGIProcessGroup MyApp
WSGIScriptAlias /MyApp /home/bic/MyApp/MyApp/wsgi.py
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName myapp.com
</VirtualHost>
<VirtualHost *:80>
Alias /static /home/bic/pep_web/protocol/static
<Directory /home/bic/pep_web/protocol/static>
Require all granted
</Directory>
<Directory /home/bic/pep_web/pep_learn>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess pep_web python-path=/home/bic/pep_web:/usr/lib/python2.7/dist-packages
WSGIProcessGroup pep_web
WSGIScriptAlias /pep_learn /home/bic/pep_web/pep_learn/wsgi.py
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName mypepapp.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
127.0.0.1 localhost
::1 localhost
#your local domains
127.0.0.1 myapp.com
127.0.0.1 mypepapp.com