在共享托管服务器上使用烧瓶的问题
我正在尝试在Bluehost共享的托管服务器上部署烧瓶应用程序。我一直在关注本指南。我做了一个更改,那就是.fcgi
文件中。我不使用flup
。这是我的.fcgi
file(flask.fcgi
):
#!/path/to/venv/bin/python
from wsgiref.handlers import CGIHandler
from server import app
CGIHandler().run(app)
我已经使文件可执行,当我运行./ blask.fcgi
时从命令行(通过SSH),它返回索引路由的HTML页面,这是我期望的。但是,如果我导航到mydomain.com/flask.fcgi
我会收到500个内部服务器错误。检查服务器日志我可以看到此消息:
/path/to/venv/bin/python: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
我在安装openssl
时遇到此错误,并通过设置ld_library_path
环境变量来对其进行整理,以包括到达位置的路径库已安装。这是我的.htaccess
文件:
# For Flask
PassEnv LD_LIBRARY_PATH
PassEnv REQUEST_METHOD
Options +ExecCGI
AddHandler fcgid-script .fcgi
RewriteEngine On
# For Flask
RewriteCond %{REQUEST_FILENAME} !=/path/to/public_html/flask.fcgi
RewriteRule ^(.*)$ flask.fcgi/$1 [QSA,L]
RewriteOptions inherit
您可以看到我尝试传递ld_library_path
变量,但毫无用处,我继续收到500个内部服务器错误,不管我是直接导航到mydomain.com/page
还是直接到mydomain.com/flask.fcgi
。
我完全不愿从这里去哪里,任何帮助将不胜感激。
I'm trying to deploy a Flask application on a BlueHost shared hosting server. I have been following this guide. I have made one change, and that is in the .fcgi
file. I'm not using flup
. This is my .fcgi
file (flask.fcgi
):
#!/path/to/venv/bin/python
from wsgiref.handlers import CGIHandler
from server import app
CGIHandler().run(app)
I've made the file executable, and when I run ./flask.fcgi
from the command line (via SSH) it returns the HTML page for the index route, which is what I expect. But if I navigate to mydomain.com/flask.fcgi
I receive a 500 Internal Server error. Checking the server logs I can see this message:
/path/to/venv/bin/python: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
I encountered this error before while installing openssl
and rectified it by setting the LD_LIBRARY_PATH
environment variable to include the path to the location where the libraries were installed. This is my .htaccess
file:
# For Flask
PassEnv LD_LIBRARY_PATH
PassEnv REQUEST_METHOD
Options +ExecCGI
AddHandler fcgid-script .fcgi
RewriteEngine On
# For Flask
RewriteCond %{REQUEST_FILENAME} !=/path/to/public_html/flask.fcgi
RewriteRule ^(.*)$ flask.fcgi/$1 [QSA,L]
RewriteOptions inherit
You can see that I try to pass in the LD_LIBRARY_PATH
variable, but to no avail, I continue to receive the 500 Internal Server errors, regardless of whether I navigate to mydomain.com/page
or to mydomain.com/flask.fcgi
directly.
I'm entirely at a loss of where to go from here, any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我弄清楚了问题是什么。我需要设置
ld_library_path
和ld_run_path
在编译openssl
和python
之前。我设置了路径,然后运行./配置
和make&&为
,而openssl
进行安装python
则相同。So I figured out what the problem was. I needed to set
LD_LIBRARY_PATH
andLD_RUN_PATH
before compilingopenssl
andpython
. I set the paths and then ran./Configure
andmake && make install
foropenssl
, and the same forpython
.