运行 Django 和 PHP Apache 中的应用程序
Run both Django and PHP application in Apache
我正在尝试在 Apache 中托管 Django 和 PHP(wordpress) 应用程序
domain.com,应指向 Django 应用程序
domain.com/wp,应该指向 wordpress app
这是我在 /etc/apache2/sites-available
中的 000-default.conf
<VirtualHost *:80>
DocumentRoot "/var/www/html/wp"
ServerName domain.com/wp
Alias /wp /var/www/html/wp
<Directory /var/www/html/wp>
Options Indexes FollowSymLinks
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
Alias /static /var/www/html/portal/static
<Directory /var/www/html/portal/static>
Require all granted
</Directory>
<Directory /home/ubuntu/portal/portal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess portal python-path=/home/ubuntu/portal:/home/ubuntu/portal/env/lib/python2.7/site-packages
WSGIProcessGroup portal
WSGIScriptAlias / /home/ubuntu/portal/portal/wsgi.py
</VirtualHost>
domain.com 带我去 wordpress 应用程序。
任何人都可以告诉我问题出在哪里或者给我一个解决这个问题的方向。
几个问题,首先是 ServerName 只是一个服务器名称,而不是 url。第二个问题是您应该合并两个 VirtualHost 条目。
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName domain.com
Alias /wp /var/www/html/wp
<Directory /var/www/html/wp>
Options Indexes FollowSymLinks
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
Alias /static /var/www/html/portal/static
<Directory /var/www/html/portal/static>
Require all granted
</Directory>
# this really should be a sub directory of /var/www/html
# if your server config follows symlinks, just make a symlink
<Directory /home/ubuntu/portal/portal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess portal python-path=/home/ubuntu/portal:/home/ubuntu/portal/env/lib/python2.7/site-packages
WSGIProcessGroup portal
WSGIScriptAlias / /home/ubuntu/portal/portal/wsgi.py
</VirtualHost>
我正在尝试在 Apache 中托管 Django 和 PHP(wordpress) 应用程序
domain.com,应指向 Django 应用程序 domain.com/wp,应该指向 wordpress app
这是我在 /etc/apache2/sites-available
中的 000-default.conf<VirtualHost *:80>
DocumentRoot "/var/www/html/wp"
ServerName domain.com/wp
Alias /wp /var/www/html/wp
<Directory /var/www/html/wp>
Options Indexes FollowSymLinks
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
Alias /static /var/www/html/portal/static
<Directory /var/www/html/portal/static>
Require all granted
</Directory>
<Directory /home/ubuntu/portal/portal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess portal python-path=/home/ubuntu/portal:/home/ubuntu/portal/env/lib/python2.7/site-packages
WSGIProcessGroup portal
WSGIScriptAlias / /home/ubuntu/portal/portal/wsgi.py
</VirtualHost>
domain.com 带我去 wordpress 应用程序。
任何人都可以告诉我问题出在哪里或者给我一个解决这个问题的方向。
几个问题,首先是 ServerName 只是一个服务器名称,而不是 url。第二个问题是您应该合并两个 VirtualHost 条目。
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName domain.com
Alias /wp /var/www/html/wp
<Directory /var/www/html/wp>
Options Indexes FollowSymLinks
AllowOverride None
Order Deny,Allow
Allow from all
</Directory>
Alias /static /var/www/html/portal/static
<Directory /var/www/html/portal/static>
Require all granted
</Directory>
# this really should be a sub directory of /var/www/html
# if your server config follows symlinks, just make a symlink
<Directory /home/ubuntu/portal/portal>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess portal python-path=/home/ubuntu/portal:/home/ubuntu/portal/env/lib/python2.7/site-packages
WSGIProcessGroup portal
WSGIScriptAlias / /home/ubuntu/portal/portal/wsgi.py
</VirtualHost>