在同一个Apache服务器上运行Django Web应用程序和wordpress时出现问题

时间:2016-10-27 03:13:42

标签: python django wordpress apache mod-wsgi

我正在为我的网站建立一个wordpress博客。我正在AWS实例上部署整个应用程序。当我重定向到我的实例的PublicDNS时,我希望看到我的网站,当我使用PublicDNS / blog时,我想看到我的博客。我有使用python开发的web应用程序。 我正在尝试设置反向代理来实现此目的。

另外,我按照以下链接设置mod_wsgi

https://www.sitepoint.com/deploying-a-django-app-with-mod_wsgi-on-ubuntu-14-04/

我做的是这个

sudo vi /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin ubuntu@localhost
#       DocumentRoot /home/ubuntu/myproject
     DocumentRoot /var/www/html/
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:80>
WSGIScriptAlias /mypath/ /home/ec2-user/myproject/apache/wsgi.py
<Directory "/home/ec2-user/myproject/apache/">
  Require all granted
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

<VirtualHost *:80>
  ServerAdmin root@localhost
  DocumentRoot /var/www/
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  ProxyPreserveHost On
  # Servers to proxy the connection, or
  # List of application servers Usage
  ProxyPass / http://54.67.96.30:8080/
  ProxyPassReverse / http://54.67.96.30:8080/
  ServerName localhost
</VirtualHost>

不是成功的。请帮我解决一下这个。如果我需要进行任何其他更改以使我的Django和wordpress在同一个apache服务器上运行,也请指导我

这是我的error.log

ubuntu@ip-XXX-XX-X-XX:/var/log/apache2$ cat error.log
[Sun Nov 06 07:58:56.224050 2016] [mpm_prefork:notice] [pid 1063] AH00163:                                         Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 mod_wsgi/3.4 Python/2.7.6 configured   -- resuming normal operations
[Sun Nov 06 07:58:56.224115 2016] [core:notice] [pid 1063] AH00094: Command     line: '/usr/sbin/apache2'
[Sun Nov 06 11:54:32.059667 2016] [:error] [pid 15819] [client  189.219.102.10:34144] script '/var/www/html/command.php' not found or unable to  stat
[Sun Nov 06 11:54:32.489969 2016] [core:error] [pid 15818] [client   189.219.102.10:34149] AH00126: Invalid URI in request GET   /../../../../../../../mnt/mtd/qt HTTP/1.0
[Sun Nov 06 15:54:03.556565 2016] [:error] [pid 15819] [client  91.196.50.33:35265] script '/var/www/html/testproxy.php' not found or unable to stat
[Mon Nov 07 04:58:22.325454 2016] [:error] [pid 15818] [client   185.25.148.240:52671] script '/var/www/html/testproxy.php' not found or unable to stat
[Mon Nov 07 16:34:19.809578 2016] [core:error] [pid 15813] [client 220.202.123.178:2844] AH00126: Invalid URI in request GET HTTP/1.1 HTTP/1.1
[Mon Nov 07 17:52:01.884887 2016] [:error] [pid 15819] [client 91.196.50.33:55532] script '/var/www/html/testproxy.php' not found or unable to stat

0 个答案:

没有答案