Tag Archives: Apache

CentOS Apache配置SSL让网站对外提供https服务

本文假设你的apache是通过 yum的方法安装的。(手工编译安装的请立刻关闭此文,难到你还不会SSL配置?)

启动apache命令:
systemctl start httpd.service (注意不是:service httpd start ,老命令了)

默认apache是没有安装SSL模块的,所以需要安装,接着使用命令:
yum install -y mod_ssl

安装结束后,在你的/etc/httpd/conf.d 下面会出现一个 SSL.conf ,否则是没有的

打开SSL.conf,要配置一下。

首先来到 这样的字样。寻找、替换或者自己打入如下配置:

DocumentRoot “这里填你网站的根目录”
ServerName 域名:443

接下来就是配置证书路径:(这里建议大家去网上找个SSL购买证书的网站,譬如“沃通”,然后去申请个临时免费的证书。不要自签名,没啥意思。网上又不要钱,临时用完了再申请一次)

申请好证书后,一般会给你三个文件。一个是根证书(譬如root_bundle.crt),一个是服务端证书(譬如www.xxx.com.crt),一个是证书私钥(譬如www.xxxx.com.key).大家注意后缀名,自己想一想。

然后把这三个证书通过ftp传到你喜欢的文件夹中。

一般来说 我们网站都只要服务端单向认证,也就是不需要验证客户端,那么只要配置以下两个部分[……]

继续阅读

Centos7 安装Discuz全过程

1、安装Apache服务
yum install httpd

2、安装Mysql服务
2.1 下载mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2.2 安装mysql-community-release-el7-5.noarch.rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm

2.3 安装Mysql服务
yum install mysql-server

2.4 启动Mysql
service mysqld start

2.5 修改Mysql root 密码
mysqladmin -u root password ******

3、安装PHP[……]

继续阅读

CentOS 添加虚拟主机VirtualHost及伪静态Rewrite

1、找到Apache的配置文件 /etc/httpd/conf/httpd.conf

2、找到配置文件中的以下代码

LoadModule vhost_alias_module modules/mod_vhost_alias.so

如果前面有#号注释,去掉#号注释,这代表是否开启虚拟主机服务

3、找到配置文件中的以下代码,一般在配置文件的最末尾部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier 
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
 
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<virtualhost *:80>
#    ServerAdmin [email protected]
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</virtualhost>

需要用到的部分有[……]

继续阅读

让CentOS服务器支持https(安全http协议)

1、安装mod_ssl

通过yum来在线安装mod_ssl
[root@Crayfish home]# yum -y install mod_ssl ? ???← 在线安装mod_ssl
Loaded plugins: security
base? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 3.7 kB? ???00:00
epel? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 4.4 kB? ???00:00
extras? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???| 3.4 kB? ???00:00
updates? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 3.4 kB? ???00:00
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package mod_ssl.x86_64 1:2.2.15-31.el6.centos will be installed
–> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
Package? ?? ?? ?? ?Arch? ?? ?? ?? ???Version? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?Repository? ?? ?? ? Size
====================================================================================================
Installing:
mod_ssl? ?? ?? ?? ?x86_64? ?? ?? ?? ?1:2.2.15-31.el6.centos? ?? ?? ?? ?? ?updates? ?? ?? ?? ? 91 k

Transaction Summary
====================================================================================================
Install? ?? ? 1 Package(s)[……]

继续阅读