学习笔记:初识httpd

栏目: 服务器 · 发布时间: 7年前

内容简介:设置开机启动chkconfig httpd onchkconfig mysqld on
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 的开源项目

curl https://get.acme.sh | 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 的配置文件。


以上所述就是小编给大家介绍的《学习笔记:初识httpd》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

Letting Go of the Words

Letting Go of the Words

Janice (Ginny) Redish / Morgan Kaufmann / 2007-06-11 / USD 49.95

"Redish has done her homework and created a thorough overview of the issues in writing for the Web. Ironically, I must recommend that you read her every word so that you can find out why your customer......一起来看看 《Letting Go of the Words》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具