https阿里云证书购买与apache环境配置
1.在阿里云云盾安全->CA证书购买
2.下载证书解压文件,一般有四个文件
3.在/etc/apache2 下创建一个文件夹cert 放入以上四个文件(路径可自己任意选择)
4.$sudo a2enmod ssl
这条命令相当于
sudo ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled
sudo ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled
如果没有a2enmod指令,也可直接在apache2.conf中设置SSL模块加载:
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
5.在、/etc/apache2/sites-availables/default-ssl.conf中更改以下三个文件的路径为刚才上传的路径
此文件可能在/etc/apache2/sites-enabled/default-ssl.conf(保证两个地方都有此文件且内容相同即可)
SSLCertificateFile /etc/apache2/cert/public.pem
SSLCertificateKeyFile /etc/apache2/cert/214498210030298.key
SSLCertificateChainFile /etc/apache2/cert/chain.pem
6.重启apache2(/etc/init.d/apache2 restart)
7.将生成证书的域名解析到你主机的IP即可使用https访问
8.将https定位到入口指定文件
9.添加监听端口
编辑Apache端口配置(/etc/apache2/ports.conf),加入443端口(SSL缺省使用):
Listen 80
Listen 443
10.开启路由重写
Ubuntu下apache2的rewrite模块默认是不加载的。
只要运行了一下这个命令:a2enmod rewrite 就可以启用rewrite模块了。
备注:
Apaceh2 多了一组 a2enmod, a2dismod指令,用于启用和禁用Apache的模块。a2enmod用于在Apache启用指定的模块,它实际上做的是在/etc/apache2 /mods-enabled目录下创建模块文件的符号链接。相反a2dismo则是通过删除符号链接而达到禁用指定模块的功能。当然,启用已启用的模块或禁用已禁用的模块是不会报错的。^^
这里有必要说明一下:
/etc/apache2/mods-available 放apache可用的模块文件
/etc/apache2/mods-enabled 放apache已启用的模块文件的链接
弄明白了,去查看一下/etc/apache2/mods-enabled目录,果然有新增了一条rewrite.load的链接。
修改/etc/apahce2/apahce2.conf
把 下面注释部分改掉
#<Directory /var/www/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
重启apache 即可去掉index.php访问
11.配置虚拟主机
修改文件
vi /etc/apache2/sites-avilabe/000-default.conf
代码如下:
添加一条(注意端口为443)
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/public(指定文件目录)
ServerName www.xxx.com(你的域名)
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
重启apache2即可用https访问并定位到指定的文件
最新文章
- 浅析WPhone、Android的Back与Home键
- 【工具】 原版完美激活 Flash builder 4.7 【非破解激活】
- 图书馆管理系统—NABCD模型竞争性需求分析
- git添加标签(转载)
- 阿里云 centos 环境配置与 django 部署
- python--threading多线程总结
- parent.location.href和location.href区别
- poj 2769 Reduced ID Numbers(memset使用技巧)
- pro-engineer&;UG
- 架构设计之设计模式 (一) 适配器(Adapter)---提高复用性
- 玲珑学院-ACM比赛1014 - Absolute Defeat
- ●BZOJ 4289 PA2012 Tax
- transport error 202: bind failed: 地址已在使用
- Python学习(25):Python执行环境
- sql 的理解
- springMVC学习(10)-上传图片
- UVa 10213 - How Many Pieces of Land ?(欧拉公式)
- onchange/onpropertychange/oninput
- LNMP 配置二级域名
- redis系统和通用函数
热门文章
- Linq 基本操作
- :eq()中的参数详解——需要注意
- MySQL中数据中设计中的范式与反范式
- 教你管理SQL实例系列(1-15)
- su: warning: cannot change directory to : Permission denied ;-bash: bash_profile: Permission denied
- ios 避免两个button同一时候被点击
- Java基础—反射(转载)
- MySQL中kill所有慢查询进程和锁表进程
- 微信公众号的搭建-第四天(2)-获取并缓存access_token
- mysql终结篇