English 中文(简体)
Djanngo: Apache DocumentRooot 不存在
原标题:Django: Apache DocumentRoot does not exist

我正试图用Md_wsgi,CentOS 6在Apache 2.6.6上运行Django 1.3.1, 使用Md_wsgi, CentOS 6。

我有更改 httpd.conf 文件 :

WSGIPythonPath /var/www/vhosts/domain.co.uk
<VirtualHost *:80>
  #ServerName domain.co.uk
  ServerName 46...233

  ##DocumentRoot /var/www/vhosts/domain.co.uk/httpdocs

  LogLevel debug
  ErrorLog /var/www/vhosts/domain.co.uk/logs/error.log
  CustomLog /var/www/vhosts/domain.co.uk/logs/access.log combinedio

  HostnameLookups Off

  UseCanonicalName On

  WSGIScriptAlias / /var/www/vhosts/domain.co.uk/sites/somod/apache/django.wsgi
  WSGIDaemonProcess somod:80 user=somod group=psaserv processes=1 threads=1
  WSGIProcessGroup somod:80
  #WSGIPythonPath /var/www/vhosts/domain.co.uk

  Alias /robots.txt /var/www/vhosts/domain.co.uk/sites/templates/robots.txt
  Alias /favicon.ico /var/www/vhosts/domain.co.uk/sites/media/favicon.ico

  <Directory "/var/www/vhosts/domain.co.uk/httpdocs">
    AllowOverride None
    Options -ExecCGI -Includes -FollowSymLinks -Indexes
    Order allow,deny
    Allow from all
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
  </Directory>

  <Directory "/var/www/vhosts/domain.co.uk/sites">
    AllowOverride None
    Options +ExecCGI -Includes +FollowSymLinks -Indexes
    Order allow,deny
    Allow from all
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript
  </Directory>

  Alias /media "/var/www/vhosts/domain.co.uk/media"
  <Location "/media/">
    SetHandler None
  </Location>
</VirtualHost>

因此我粘贴了我的 apache 配置( 只有我添加的代码) 。 这是在 < code>/ etc/ httpd/ conf/ httpd.conf 中 。

我现在可以重新打开 apache, 没有任何错误, 但网站仍然不可见。 不幸的是, 我无法运行 < code>sudo a2enmod wsgi , 我无法使用 cenos 6 和 a2enmod 。 但我确定它已经安装了, 因为我用它来订购 vps, 只是不确定它正在运行。 我会检查它 。

现在我的问题是, URL 应该是什么来查看网站? 是价值格式服务器Name, 还是 < code> ip address/ serverName value ? 我能否使用 ip address? 因为我想要在切换域名前运行网站并确保一切正常, 因为目前这个域名下就是 我移动到新服务器的网站 。

非常感谢你的帮助

最佳回答

不知道你在做什么, 但这里有一个样本配置 为你的兄弟:

WSGIPythonPath /var/www/yoursite
<VirtualHost *:80>
    ServerName yoursite.com
    ServerAlias testing.yoursite.com

    Alias /static/ /var/www/yoursite/yourdjangoproject/static/
    # Alias /sitemap.xml /var/www/yoursite/yourdjangoproject/static/sitemap.xml
    WSGIScriptAlias / /var/www/yoursite/yourdjangoproject/wsgi.py

    <Directory />
        AllowOverride None
        Options -Indexes
    </Directory>

    <Directory /var/www/yoursite/.git/>
        Deny From All 
    </Directory>

    LogLevel info
    ErrorLog /var/log/apache2/yoursite-error.log
    CustomLog /var/log/apache2/yoursite-access.log combined
</VirtualHost>

创建此文件并命名为 < code> yoursite 并把它放在 < code>/ etc/ apache2/ sites- placed 下。 然后运行 < code>sudo a2ensite yoursite , 并且将它与 < code > sites- papedowed 下。

这取决于:

  • apache2
  • libapache2-mod-wsgi

通过运行 sudo a2enmod wsgi ,确保 wsgi 被启用 。

我建议您在版本控制回邮中保留文件,然后从 /etc/apache2/sites- place- operation 中将文件符号链接到 < code> / etc/ apache2/ sites- place- place 。

请注意,我为 /stistic/ 创建了一个别名, 如果您想要使用, 请确定您运行 < code>sudo./ manage. py commistic 。 这将把所有静态文件都放在 < code>/ var/ www/yoursite/ yourproject/static 中 。

祝你好运

问题回答

暂无回答




相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签