..
声明:
本博客欢迎转发,但请保留原作者信息!
博客地址:http://blog.csdn.net/liujiong63
新浪微博:@Jeremy____Liu
内容系本人学习、研究和总结,如有雷同,实属荣幸!
环境:centos7.2.1511
新版本Apache的配置较旧版本略有不同
修改Apache配置文件
修改apache2/conf/httpd.conf文件
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
Apache加载ssl模块,配置
修改apache2/conf/extra/httpd-ssl.conf文件
修改ServerName www.example.com:443
修改ServerAdmin you@example.com
SSLEngine on
SSLCertificateFile "/etc/openstack-dashboard/ssl/cert.pem"
SSLCertificateKeyFile "/etc/openstack-dashboard/ssl/key.pem"
修改dashboard的配置
修改apache2/conf/extra/openstack-dashboard.conf文件为如下内容:
# 此项为配置http跳转到https
<VirtualHost 172.16.1.102:80>
ServerName 172.16.1.102
ServerAlias 172.16.1.102
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
<VirtualHost 172.16.1.102:443>
ServerName 172.16.1.102
<Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
Options All
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share/openstack-dashboard/static>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
## Logging
ErrorLog "/usr/local/vulfix/apache2/logs/horizon_error.log"
ServerSignature Off
CustomLog "/usr/local/vulfix/apache2/logs/horizon_access.log" combined
## RedirectMatch rules
RedirectMatch permanent ^/$ /dashboard
## Server aliases
ServerAlias 172.16.1.102
WSGIDaemonProcess dashboard group=apache processes=1 threads=10 user=apache
WSGIProcessGroup dashboard
WSGIScriptAlias /dashboard "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi"
Alias /dashboard/static /usr/share/openstack-dashboard/static
SSLEngine on
SSLCertificateFile /etc/openstack-dashboard/ssl/cert.pem
SSLCertificateKeyFile /etc/openstack-dashboard/ssl/key.pem
</VirtualHost>
制作证书和密钥文件
证书的CommonName和openstack-dashboard.conf中VirtualHost配置的ServerName保持一致