使用devstack安装openstack成功后访问dashboard遇到500错误

使用devstack安装openstack成功后访问dashboard遇到500错误。

参见:《打开Openstack dashboard出现Internal Server Error》

本来访问dashboard的好好的,但是突然访问不了了,显示:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

开始重启了apache2 ,没用。看了下apache的组件,也看着是都没问题。

本来要放弃了,直接重新安装算了。但是回想了下自己的操作,决定开始看error.log再动手。

看了下,apache2 的error.log在/var/log/apache2/下,里面有几个log文件,包括error.log、horizon.log等,先看了error.log,没发现什么问题,又看了horizon-access.log,也没什么有用信息,最后看了horizon-err.log,发现最后一条是:

horizon.utils.secret_key.FilePermissionError: Insecure permissions on key file /opt/stack/horizon/openstack_dashboard/local/.secret_key_store, should be 0600.

看来这个权限说是600,我看了下我的,是777。
然后按这个关键字查了下,查到了开头引用的文档,就参考这个文档把文件改名为了:

cp .secret_key_store .secret_key-store.old

重新刷新了下dashboard,果然dashboard恢复了。

回想了之前的操作,好像是把/opt/stack目录修改过权限为777。
history了下,果然有:
chmod -R 777 /opt/stack

扫描二维码关注公众号,回复: 13084752 查看本文章

既然发现了问题,那得重现下才可以:

再次

sudo su - root
chmod -R 777 /opt/stack/horizon/openstack_dashboard/local/.secret_key_store

刷新了下dashboard页面,依然可以访问,
看来要重新启动下apache2

cd /etc/init.d
./apache2 restart

再次刷新下dashboard页面,果然500重现了。

再次:

chmod -R 600 /opt/stack/horizon/openstack_dashboard/local/.secret_key_store
./apache2 restart

再次刷新下dashboard页面,果然熟悉的openstack页面重现了。

SECRET_KEY(New in version 2012.1(Essex)) 设置一个自定义的密钥:你可以将它设置为一个特定的值,或者你可以让horizon上生成一个默认的密钥在本机上,无论Python WSGI(如果使用在Apache + mod_wsgi)。在许多情况下,你会想把它设定,例如当多个dashboard实例分布在不同的机器上(通常在一个负载均衡器)。你必须确保会话获取所有请求路由到相同的dashboard实例或你为它们设置相同的secret_key。 From horizon.utils import secret_key:

SECRET_KEY = secret_key.generate_or_read_from_file(
os.path.join(LOCAL_PATH, ‘.secret_key_store’))
local_settings.py.example文件包括一个快速和容易的方法来生成一个单一的安装密钥。

猜你喜欢

转载自blog.csdn.net/m0_49212388/article/details/107835012