作为一个小背景,我一直在为1&1共享主机网站开发一个django应用程序.当我尝试将应用程序移植到网络上时,我从这里开始遵循教程:http://robhogg.me.uk/post/2.服务器有Python 2.6,我通过SSH安装了django和flup.这是我的.fsgi文件......
#!/usr/bin/python
import sys, os
basepath = '/home/path/' # This isn't my actual homepath
sys.path.insert(0, basepath + '/.local/lib')
sys.path.insert(0, basepath + '/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method='threaded', daemonize='false')
Run Code Online (Sandbox Code Playgroud)
......这是我的.htaccess文件......
AddHandler fcgid-script .fcgi
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !(cgi-bin/mysite.fcgi)
RewriteRule ^(.*)$ cgi-bin/mysite.fcgi/$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)
我也已经给了.fcgi脚本755权限.当我运行.fcgi脚本时,主页HTML在控制台上打印(根据许多站点,这意味着脚本是好的).但是,当我访问我的网站的域名时,我只得到一个位于我的主目录中的Index.html页面.所以我从主目录中移动了所有html文件,然后再次尝试.但是这次我收到一个错误:
Forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Run Code Online (Sandbox Code Playgroud)
我又尝试了一件事,那就是.htaccess文件,改变了 …