最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Centos7.6 http服務(wù)搭建全攻略

2021-08-13 17:52 作者:墨大仙仙仙  | 我要投稿

1、安裝apache服務(wù)

yum??clean?all

yum?install?-y?httpd

2、啟動服務(wù)并驗(yàn)證

systemctl??start?httpd

瀏覽器127.0.0.1

3、創(chuàng)建網(wǎng)站根目錄和首頁文件

mkdir?-p?/data/www

chmod?-R?o+rx?/data

echo?"welcome?to?my?website"?>/data/www/index.html

cat??/data/www/index.html

4、修改apache主配置文件

cd?/etc/httpd/conf

mv??httpd.conf?httpd.conf.bak

grep?-v?"#"?httpd.conf.bak>httpd.conf

vim?httpd.conf

ServerName?ns1.myj.edu.cn

DocumentRoot?"/data/www"

<Directory?"/data/www">

AllowOverride?None

Require?all?granted

DirectoryIndex?index.html

</Directory>

5、重啟httpd服務(wù),防火墻放行

systemctl?restart?httpd

firewall-cmd?--permanent?--add-service=http

firewall-cmd?--reload

firewall-cmd?--list-all

setenforce?0



拓展1:創(chuàng)建虛擬目錄

1、創(chuàng)建虛擬目錄和分配權(quán)限

mkdir?-?p?/ito/www

chmod?-R?o+rx?/ito

echo?"this?is?in/ito/www">/ito/www/index.html

2、修改配置文件/etc/httpd/conf/httpd.conf

Alias?/doc?"/ito/www"

<Directory?"/ito/www">

AllowOverride?none

Require?all?granted

</Directory>

3、重啟httpd服務(wù)

systemctl?restart?httpd


拓展2:創(chuàng)建用戶個人主頁

1、創(chuàng)建用戶名和目錄

useradd??myj

useradd?myj2

chmod?-R?o+rx?/home/myj

chmod?-R?o+rx?/home/myj2

mkdir?-p?/home/myj/www

mkdir?-p?/home/myj2/www

echo?"this?is?myjwww"?>?/home/myj/www/index.html

echo?"this?is?myj2?www"?>?/home/myj/www/index.html

2、修改用戶主頁配置文件/etc/httpd/conf.d/userdir.conf

vim?/etc/httpd/conf.d/userdir.conf

<IfModule?mod_userdir.c>

#UserDir?disabled

UserDir?www

</IfModule>

<Directory?"/home/*/public_html">

修改成

<Directory?"/home/*/www">

3、重啟httpd服務(wù)

systemctl?restart?httpd

4、驗(yàn)證http://192.168.128.100/~myj

?????????????http://192.168.128.100/~myj2


拓展3:創(chuàng)建虛擬主機(jī)

1、修改網(wǎng)卡配置文件增加ip地址

cat?/var/named/zone.myj.edu.cn

vim?/etc/sysconfig/network-scripts/ifcfg-ens33

IPADDR0=192.168.128.100

PREFIX0=24

GATEWAY0=192.168.128.254

IPADDR1=192.168.128.120

PREFIX1=24

GATEWAY1=192.168.128.254

DNS1=192.168.128.100

systemctl?restart?network

2、創(chuàng)建虛擬主機(jī)的根目錄和首頁文件,分配權(quán)限

mkdir?-p?/data/www2

chmod?-R?o+rx?/data/www2

echo?"this?is?www.myj.edu.cn"?>?/data/www2/index.html

3、創(chuàng)建vhost.conf配置文件

vim?/etc/httpd/conf.d/vhost.conf

<Virtualhost?192.168.128.100>

????????????DocumentRoot?/data/www

????ServerName?ns1.myj.edu.cn

????????????<Directory?/>

????????????????AllowOverride?none

????????????????Require?all?granted

????????????</Directory>

</Virtualhost>

<Virtualhost?192.168.128.120>

????????????DocumentRoot?/data/www2

????????????ServerName?www.myj.edu.cn

????????????<Directory?/>

????????????????AllowOverride?none

????????????????Require?all?granted

????????????</Directory>

</Virtualhost>

4、重啟httpd服務(wù)

systemctl?restart?httpd



Centos7.6 http服務(wù)搭建全攻略的評論 (共 條)

分享到微博請遵守國家法律
皋兰县| 黄梅县| 蓬莱市| 昂仁县| 莎车县| 巴南区| 碌曲县| 雷州市| 祥云县| 上林县| 周宁县| 敖汉旗| 改则县| 石楼县| 长顺县| 奉化市| 西乡县| 桓台县| 宽城| 洞头县| 济源市| 视频| 湖南省| 右玉县| 阳江市| 赤城县| 辉县市| 民乐县| 嘉峪关市| 阿克苏市| 金山区| 汝州市| 昌都县| 宁武县| 丰县| 莲花县| 石门县| 平昌县| 南郑县| 梓潼县| 达州市|