educoder初识MySQL_学习笔记:初识httpd

yum install https://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm https://mirrors.ustc.edu.cn/remi/enterprise/remi-release-6.rpm

yum -y install yum-utils

yum-config-manager --enable remi-php72

yum -y install httpd mysql mysql-server mysql-connector-odbc mysql-devel libdbi-dbd-mysql openssl mod_ssl httpd-manual mod_ssl mod_perl mod_auth_mysql

yum -y install php php-mcrypt php-cli php-gd php-curl php-mysql php-zip php-fileinfo php-fpm php-xml php-mbstring php-ldap php-xmlrpc php-devel

设置开机启动

chkconfig httpd on

chkconfig mysqld on

建立虚拟主机文件夹

cd /home

mkdir www

修改httpd配置文件

cd /etc/httpd/conf

vi httpd.conf

加入

Include /home/www/vhost.conf

解析域名

新建虚拟主机

建立虚拟主机路径

cd /home/www

mkdir hk.lvcshu.info

新建虚拟主机配置

vi vhost.conf

写入

DocumentRoot /home/www/hk.lvcshu.info

ServerName hk.lvcshu.info

RewriteEngine on

RewriteCond %{SERVER_PORT} !^443

RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [R=permanent,L]

Options Indexes FollowSymLinks

AllowOverride all

Order Deny,Allow

Deny from none

Allow from all

建立一个简陋的主页

申请证书

使用 acme.sh 的开源项目

cd .acme.sh

acme.sh –issue -d hk.lvcshu.info –webroot /home/www/hk.lvcshu.info/

证书路径:/root/.acme.sh/hk.lvcshu.info

SSLCertificateFile /root/.acme.sh/hk.lvcshu.info/hk.lvcshu.info.cer

SSLCertificateKeyFile /root/.acme.sh/hk.lvcshu.info/hk.lvcshu.info.key

配置 https

DocumentRoot /home/www/hk.lvcshu.info

ServerName hk.lvcshu.info

SSLEngine on

SSLCertificateFile /root/.acme.sh/hk.lvcshu.info/hk.lvcshu.info.cer

SSLCertificateKeyFile /root/.acme.sh/hk.lvcshu.info/hk.lvcshu.info.key

return 0;

更新:

其实有一个更加好的虚拟主机的管理方法,那就是一个网站用一个配置文件来管理,在配置文件 httpd.conf 中直接引入 /home/www/vhost/* 即可

例如在 /home/www/vhost

中 hk.lvcshu.info.dom

即为 hk.lvcshu.info

的配置文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值