apache1

Apache基本配置

安装apache软件包:

     yum install -y httpd httpd-manual

启动apache服务:

    # systemctl start httpd ; systemctl enable httpd


查看监听端口:


1.修改默认访问文件

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

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

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


 

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

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


[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


 

 3.设置黑白名单

 

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


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


 

 

4.登陆帐号密码验证



[root@linux conf]# vim httpd.conf



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

测试:


 

 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


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

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


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


测试:



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



 

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

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

 

 





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值