httpd访问控制
生成共享文件
vim var/www/html/cq/index.html
编辑配置文件
vim /etc/httpd/conf/httpd.conf
<Directory "/var/www/html/cq">
Order Deny,ALLOW                    ##读取顺序
Allow from 172.25.254.4             ##设置允许172。25.254.3登入
Deny from  All                             ##设置拒绝所有人
</Directory>

systemctl restart httpd

cd /etc/httpd/conf
ls
htpasswd -cm cquser admin              创建访问用户
htpasswd -m cquser admin1              再次创建

vim /etc/httpd/conf/httpd.conf
<Directory "/var/www/html/cq">
AuthUserFile /etc/httpd/conf/cquser   
AuthType    basic
AuthName    "please input your name and password!"
Require user admin
</Directory>

##apach的虚拟主机功能
注释掉之前的配置
创建文件
mkdir /var/www/virtual/news/html
mkdir /var/www/virtual/music/html
vim /var/www/virtual/news/html/index.html
vim /var/www/virtual/music/html/index.html

cd /etc/httpd/conf.d/
vim a_default.conf

vim news.conf

vim music.conf

当这些配置完成之后,需要在浏览器一端设置本地域名解析。
vim /etc/hosts
172.25.254.103 www.westos.com av.westos.com cctv.default.com

测试:

##php cgi 的安装
yum install php -y
vim /var/www/html/index.php
<?php
       phpinfo();                                                 php的测试页
?>

测试:172.25.254.103/index.php

cgi
yum install httpd-manual -y

mkdir /var/www/html/cgi
vim /var/www/html/cgi/index.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print 'date';
chmod 755 index.cgi

然而此时访问却只能访问裸露的代码
    
此时需要配置 vim /etc/httpd/conf.d/a_default.conf

在manual页上复制
<Directory "/var/www/html/cgi">
    Options +ExecCGI
    AddHandler cgi-script .cgi
</Directory>

systemctl restart httpd

###########################################################

       
https
yum install mod_ssl -y
yum install crypto-utils -y

genkey www.westos.com          生成证书
vim ssl.conf
crtl+z  fg 1 复制锁和钥匙存的目录到这个配置文件里
systemctl restart httpd

此时访问 https://www.westos.com

#################################################################
实现自动加锁
cd /etc/httpd/conf.d/
cp news.conf login.conf   
vim login.conf
:%s/news/login                                           将所有的news换成login
mkdir -p /var/www/virtual/login/html                   创建目录
vim /var/www/virtual/login/html/index.html        编写文件
vim /etc/httpd.conf/login.conf
vim  /etc//httpd/conf.d/ssl.conf
复制钥匙复制锁

systemctl restart httpd
测试;
访问 login.westos.com       注:测试机若没有解析请添加解析 vim/etc/hosts :login.westos.com
结果自动切换到https
##################################################################3
squid
首先在虚拟机上安装squid
yum install squid -y
配置好虚拟机的网关和dns
开启squid
systemctl start squid
netstat -antlupe | grep squid 查看端口
vim /etc/squid/squid.conf
56 http_access allow all
62 取消注释
systemctl restart squid
之后可以通过虚拟机让真机上网

######################################################
squid的缓存
设备
reset的desktop
安装 squid
vim /etc/squid/squid.conf
http_access allow all
# Squid normally listens to port 3128
http_port 80 vhost vport
cache_peer 172.25.254.104 parent 80 0 proxy-only round-robin originserver name=web1
cache_peer 172.25.254.103 parent 80 0 proxy-only round-robin originserver name=web2
cache_peer_domain web1 web2 www.westos.com
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 100 16 256
systemctl restart squid
vim /etc/hosts
www.westos.com 172.25.254.204
测试:在虚拟机上firefox  
www.westos.com
 

Linux中apache服务的更多相关文章

  1. Linux系统Apache服务 - 配置 HTTP 的虚拟机主机

    接Linux系统Apache服务 - 配置HTTP的默认主页 1.创建/srv目录,作为httpd的文件目录,并创建/srv/default/www和/srv/www1.example.com/www ...

  2. Linux下Apache服务部署静态网站------网站服务程序

    文章链接(我的CSDN博客): Linux下Apache服务部署静态网站------网站服务程序

  3. Linux中Sshd服务配置文件优化版本(/etc/ssh/sshd_config)

    Linux中Sshd服务配置文件优化版本(/etc/ssh/sshd_config) # $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Ex ...

  4. linux搭建apache服务并修改默认路径

    该篇文章主要讲解如何在linux服务器上搭建apache服务器,并修改指定的apache路径到自定义路径下 一:检查服务器上是否已安装apache,停止并卸载系统自带apache服务 命令为:rpm ...

  5. Linux中Apache服务器的简单配置

    配置Apache服务器: 1.安装Apache,可以参考Linux 中yum的配置来安装: yum install http* -y 2.修改SELinux: setenforce 0 查看: 3.防 ...

  6. Linux中Apache+Tomcat+JK实现负载均衡和群集的完整过程

    人原创,一个字一个字地码的,尊重版权,转载请注明出处! http://blog.csdn.net/chaijunkun/article/details/6987443 最近在开发的项目需要承受很高的并 ...

  7. Linux下Apache服务的部署和配置

    目录 Apache服务的安装 yum源安装: 目录文件 源码包安装: 目录文件: Apache中添加对php的支持 Apache中添加php对mysql数据库的支持 Apache服务的高级配置 1:配 ...

  8. Linux安装apache服务

    1.通过yum包下载安装httpd yum -y install httpd*(等待安装) 到下面就安装完毕 2.启动apache服务 service httpd restart 3.现在就可以查看a ...

  9. Spring Boot 如何部署到 Linux 中的服务

    打包完成后的 Spring Boot 程序如何部署到 Linux 上的服务? 你可以参考官方的有关部署 Spring Boot 为 Linux 服务的文档. 文档链接如下: https://docs. ...

随机推荐

  1. [codeforces126B]Password

    解题关键:KMP算法中NEXT数组的理解. #include<bits/stdc++.h> #define maxn 1000006 using namespace std; typede ...

  2. ArcEngine中多边形内外环的处理(转)

    ArcEngine中多边形内外环的处理 原创 2012年09月06日 22:49:11 标签: object / null / 数据库 3462 Polylgon对象是由一个或多个Ring对象的有序集 ...

  3. 使用ServerSocket建立聊天服务器(二)

    -------------siwuxie095                         工程名:TestMyServerSocket 包名:com.siwuxie095.socket 类名:M ...

  4. __tostring和__invoke 方法

    首先放上代码: <?php class MagicTest{ //__tostring会在把对象转换为string的时候自动调用 public function __tostring() { r ...

  5. SpringBoot07 异常枚举、自定义异常、统一的全局异常处理

    1 异常编号和提示信息统一管理 利用枚举来实现异常的统一管理 package cn.xiangxu.springboottest.enums; import lombok.Getter; /** * ...

  6. UIScrollView现实自动循环滚动

    #import "RootViewController.h" #define width [UIScreen mainScreen].bounds.size.width #defi ...

  7. ZROI2018普转提day7t1

    传送门 分析 一道有意思的小题... 我们发现如果$(1,1)$为白色,则将其变为白色需要偶数次操作,而如果为黑色则需要奇数次操作 我们知道要让A赢需要奇数次操作,所以我们只需要判断$(1,1)$的颜 ...

  8. ZROI2018提高day6t2

    传送门 分析 将所有字母分别转化为1~26,之后将字符串的空位补全为0,?设为-1,我们设dp[p][c][le][ri]表示考虑le到ri个字符串且从第p位开始考虑,这一位最小填c的方案数,具体转移 ...

  9. HttpServletResponse和HttpServletRequest详解.RP

    HttpServletResponse,HttpServletRequest详解 1.相关的接口   HttpServletRequest HttpServletRequest接口最常用的方法就是获得 ...

  10. 图测试题部分总结.ing

    一个无向连通图的生成树是含有该连通图的全部顶点的(极小连通子图) 在有向图G的拓扑序列中,若顶点Vi在顶点Vj之前,则下列情形不可能出现的是(D)A.G中有弧<Vi,Vj> B.G中有一条 ...