ubuntu14.0 配置apahe2https

1、sudo a2enmod ssl

Considering dependency setenvif for ssl:

Module setenvif already enabled

Considering dependency mime for ssl:

Module mime already enabled

Considering dependency socache_shmcb for ssl:

Enabling module socache_shmcb.

Enabling module ssl.

See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.

To activate the new configuration, you need to run:

service apache2 restart

/usr/share/doc/apache2/README.Debian.gz  中有对应的配置ssl教程

2、修改配置/etc/apache2/sites-available/default-ssl.conf

打开default-ssl.conf,找到这两个

SSLCertificateFile

SSLCertificateKeyFile

指向对应自己的目录

SSLCertificateFile /home/linwen/AndroidStudioProjects/https/server.crt

SSLCertificateKeyFile /home/linwen/AndroidStudioProjects/https/server.key

重启

访问https://127.1.1.0/

3、更改访问目录

/etc/apache2/sites-available/default-ssl.conf

DocumentRoot 更改微自己的主目录

4、配置自己的网址

ServerAdmin下面加上一行

ServerName Test.com

重启

5、配置单一站点为https

配置单一站点必须是先执行sudo a2enmod ssl  开启ssl模块

ServerName Test.com

ServerAlias *.Test.com

DocumentRoot /home/linwen/Apache2Workspaces/www/html/bailinong-server-v2/public

SSLEngine on

SSLCertificateFile /home/linwen/AndroidStudioProjects/https/server.crt

SSLCertificateKeyFile /home/linwen/AndroidStudioProjects/https/server.key

Options Indexes FollowSymLinks

AllowOverride All

Require all grantedErrorLog

${APACHE_LOG_DIR}/error.logCustomLog

${APACHE_LOG_DIR}/access.log combined

然后把文件放到

/etc/apache2/sites-available/000-default.conf

在最后面导入

IncludeOptional sites-available/你的名字.conf

你可能感兴趣的:(ubuntu14.0 配置apahe2https)