A 500 error was encountered when accessing dashboard after successful installation of openstack using devstack

After successfully installing openstack using devstack, I encountered a 500 error when accessing the dashboard.

See: "Internal Server Error appears when you open the Openstack dashboard"

It was good to access the dashboard, but suddenly it can’t be accessed. It displays:
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.

Started to restart apache2, it was useless. I looked at the components of apache, and it was all right.

I had to give up, just reinstall it. But after thinking about my own operation, I decided to start looking at the error.log before doing it again.

After looking at it, the error.log of apache2 is under /var/log/apache2/, there are several log files, including error.log, horizon.log, etc. I first looked at the error.log, but I didn’t find any problems, and then looked at it. I read the horizon-access.log, but there is no useful information. I finally read the horizon-err.log and found that the last item is:

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

It seems that the permission is 600. I looked at mine and it was 777.
Then I checked it by this keyword, and found the document cited at the beginning. I referred to this document and renamed the file:

cp .secret_key_store .secret_key-store.old

The dashboard was refreshed again, and the dashboard was restored.

Recalling the previous operation, it seems that the permissions of the /opt/stack directory have been changed to 777.
After the history, there really is:
chmod -R 777 /opt/stack

Now that the problem is found, it must be reproduced:

once again

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

After refreshing the dashboard page, it can still be accessed.
It seems that apache2 needs to be restarted.

cd /etc/init.d
./apache2 restart

Refresh the dashboard page again, and the 500 reappears as expected.

once again:

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

Refresh the dashboard page again, and the familiar openstack page really reappears.

SECRET_KEY (New in version 2012.1(Essex)) Set a custom key: you can set it to a specific value, or you can let horizon generate a default key on this machine, regardless of Python WSGI ( If used in Apache + mod_wsgi). In many cases, you will want to set it up, such as when multiple dashboard instances are distributed on different machines (usually in a load balancer). You must ensure that all requests for the session get routed to the same dashboard instance or you set the same secret_key for them. From horizon.utils import secret_key:

SECRET_KEY = secret_key.generate_or_read_from_file(
os.path.join(LOCAL_PATH,'.secret_key_store')) The
local_settings.py.example file includes a quick and easy way to generate a single installation key.

Guess you like

Origin blog.csdn.net/m0_49212388/article/details/107835012