• 欢迎访问VPS岛网站,国外VPS,国内VPS,国外服务器,国内服务器,服务器主机,测评及优惠码,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站 QQ群

Apache

Apache技术 刘俊杰12138 21次浏览 已收录 0个评论

Apache基本配置

安装apache软件包:

     yum install -y httpd httpd-manual

启动apache服务:

    # systemctl start httpd ; systemctl enable httpd

查看监听端口:

wKioL1hJBBDCHZ0nAADFxHmVsis832.png-wh_50

 

 

##1.修改默认访问文件

[root@linux thunderbird]# vim /etc/httpd/conf/httpd.conf

        164     DirectoryIndex file index.html##优先访问前者

[root@linux html]# systemctl restart httpd.service

wKioL1hJBD-DB6XKAAB6CDQTLJ4813.png-wh_50

 

##2.修改默认访问路径

[root@linux html]# vim /etc/httpd/conf/httpd.conf

wKiom1hJBFbjiDhTAAC-4yxzJnU049.png-wh_50

[root@linux html]# mkdir /www/westos -p

[root@linux html]# semanage fcontext -a -t httpd_sys_content_t ”

[root@linux html]# semanage fcontext -a -t httpd_sys_content_t ‘/www/westos(/.*)?’

[root@linux html]# restorecon -RvvF /www/

restorecon reset /www context unconfined_u:object_r:default_t:s0->system_u:object_r:default_t:s0

restorecon reset /www/westos context unconfined_u:object_r:default_t:s0->system_u:object_r:httpd_sys_content_t:s0

[root@linux westos]# vim file

[root@linux westos]# ls -Z

-rw-r–r–. root root unconfined_u:object_r:httpd_sys_content_t:s0 file

[root@linux westos]# systemctl restart httpd.service

wKiom1hJBITip0PxAABvIL0bYtw767.png-wh_50

 

 

 

 

 

##3.设置黑白名单

 

 

[root@linux westos]# vim /etc/httpd/conf/httpd.conf

wKioL1hJBJ3w47WOAADlovIGPkQ391.png-wh_50

[root@linux westos]# systemctl restart httpd.service

wKioL1hJBLaDhqV-AACemLKrLMU047.png-wh_50

 

 

 

 

##4.登陆帐号密码验证

wKioL1hJBNfQwuWSAAEtnnS1Hxc255.png-wh_50

[root@linux conf]# vim httpd.conf

wKiom1hJBO-S-_pLAACribasslE824.png-wh_50

[root@linux conf]# systemctl restart httpd.service

 

测试:

wKioL1hJBSSg1ILyAAHgc44Uskc075.png-wh_50

 

 

 

##5.制作多个同域名网站

客户端:

[root@foundation99 Desktop]# vim /etc/hosts

172.25.99.100 linux.com linux.linux.com music.linux.com news.linux.com

主机端:

[root@linux conf]# mkdir -p /var/www/virtual/music.linux.com/html

[root@linux conf]# mkdir -p /var/www/virtual/news.linux.com/html

[root@linux conf]# cd /etc/httpd/conf.d/

[root@linux conf.d]# vim default.conf

wKioL1hJBT7iMfPfAACcKj6_h84167.png-wh_50

[root@linux conf.d]# vim news.conf

wKiom1hJBVeS8vUHAACiIGOGBvQ023.png-wh_50

[root@linux conf.d]# vim music.conf

wKioL1hJBWuBjLefAACeP4eDj5c150.png-wh_50

[root@linux conf.d]# systemctl restart httpd.service

 

测试:

wKiom1hJBZbgWIxNAABzZ_hW-fQ516.png-wh_50

wKioL1hJBZeSGatdAABxvDjf7Ro484.png-wh_50

wKiom1hJBZnQmo14AAB4Nkm3Yag352.png-wh_50

 

 

 

##6.https:安全证书修改

主机端:

[root@linux html]# yum install mod_ssl.x86_64 -y

[root@linux html]# systemctl restart httpd.service

[root@linux html]# netstat -natlpe |grep 443

tcp6       0      0 :::443                  :::*                     LISTEN      0          84700      6162/httpd    

    [root@linux html]# yum install crypto-utils.x86_64 -y

  [root@linux html]# genkey www.linux.com

wKioL1hJBdKg0TyLAAFhhJq24Dw397.png-wh_50

wKiom1hJBdPztGnGAAFh1_HmF54301.png-wh_50

 

wKiom1hJC2fj473JAAFUB6BBWxM277.png-wh_50

wKioL1hJC2mSd5qUAADSgDzcxlw384.png-wh_50

wKiom1hJC2yR6e4FAADo_ffNmuQ113.png-wh_50

 

[root@linux conf.d]# vim ssl.conf

wKioL1hJC4fQFx2VAADsJIdqqpg997.png-wh_50

[root@linux conf.d]# systemctl restart httpd.service

 

 

测试:

wKiom1hJC5ewQd3IAAGPtiBHSBE031.png-wh_50

wKioL1hJC5nh2jOpAAEwJK3iqlM598.png-wh_50


 

 


VPS岛 的文章和资源来自互联网,仅作为参考资料,如果有侵犯版权的资源请尽快联系站长,我们会在24h内删除有争议的资源。丨 转载请注明Apache
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址