我正在尝试使用 mod_wsgi、CentOS 6 在 apache 2.6.6 上运行 Django 1.3.1。
我已经更改了 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 配置(只有我添加的代码)。这是在/etc/httpd/conf/httpd.conf
.
我现在可以重新启动 apache 而不会出现任何错误,但网站尚不可见。不幸的是,我无法运行sudo a2enmod wsgi
,我正在使用 cenos 6 并且a2enmod
不可用。但是我确定它已经安装了,因为我用它订购了 vps,只是不确定它是否正在运行。我会检查它。
我现在的问题是查看网站的网址应该是什么?它是 ServerName 形式的值,还是ip address/ServerName value
?我可以使用ip地址吗?因为我想在切换域之前运行网站并确保一切正常,因为现在在这个域下是我正在移动到新服务器的网站。
非常感谢您的帮助