Apache笔记2

来源:互联网 发布:任务管理系统 java开源 编辑:程序博客网 时间:2024/06/08 16:32

 Apache笔记2

一、虚拟主机的https(前提是有key)     此处以new.westos.com为例

vim new.conf

 

编辑文件时 从另一个文件向本文件复制东西时

:sp /etc/http/conf.d/ssl.conf

CTRL+w 上下换屏

 

systemctl restart httpd

测试:

 

 

二、网页重写     

vim new.conf

 

systemctl restart httpd

测试

 

 

 

三、访问PHP的测试页面

cd /var/www/html

vim index.php

 

 

vim /etc/http/conf/httpd.conf

 

systsemctl restart httpd

测试:

 

 

 

四、CGI

通用网关接口(CGI)是网站上放置动态内容的最简单的方法。CGI脚本可用于许多目

,但是谨慎控制使用哪个CGI脚本以及允许谁添加和运行这些脚本十分重要。编写质量差的CGI

脚本可能为外部攻击者提供了破坏网站及其内容安全性的途径。因此,Web服务器级别和

SELinux策略级别,都存在用于限制CGI脚本使用的设置。

cd /etc/httpd/conf.d

vim default.conf

 

 

 

cd /var/www/html

mkdir cgi

cd cgi

vim index.cgi

 

systemctl restart httpd

 

perl index.cgi

 

 

 

 

 

chmod +x index.cgi

cd /var/www

ls -Zd cgi-bin/

 

  semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/html/cgi(/.*)?'

   restorecon -RvvF /var/www/html/cgi

 

systemctl restart httpd

 

 

 

五、安装部署论坛

 

 

 

 

 

 

显示目录不可写 因此对目录添加写权限

chmod 777 upload/ -R

systemctl restart httpd

重启之后发现还是不可写  关掉selinux

setenforce 0

 

刷新之后缺少php-mysql服务

yum install php-mysql -y

systemctl restart httpd

 

 

 

 

六、翻墙(squid代理服务器正向解析)

真机 172.25.254.96(相当于baidu.com)

vim /var/www/html/index.html

www.hello.com

Desktop 172.25.254.146  172.25.46.10     (作为中间人带有appache httpd squid服务)  

双网卡

 

 

 

   

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

 vim /etc/sysconfig/network-scripts/ifcfg-eth1

 

注意!  设备名字必须一致

Desktop 既可以ping通真机 又可以pingserver

 

systemctl restart network

yum install squid -y

vim /etc/squid/squid.conf

 

 

systemctl restart squid

 

systemctl stop firewalld

 

Server 172.25.46.11

 

 

此时位于和真机不同网段的server  便可以访问到真机的页面

 

七、Squid代理服务器反向解析(你找我要我没有我去找第三方拿)

Desktop端: 无httpdapache

yum remove httpd -y

yum reinstall squid -y

1vim /etc/squid/squid.conf

 

#80端口  客户使用80端口访问

2

 

 

#添加信息可以less /usr/share/doc/squid-3.3.8/squid.conf.documented查询

#round-robin 轮循

systemctl restart squid.service

Server端:

 

vim /etc/hosts

172.25.254.146  www.baidu.com

 

测试:

1)浏览器输入172.25.254.4跳转到172.25.254.4的访问页面

2)浏览器端刷入域名www.baidu.com出现172.25.254.4的访问页面

再刷新出现172.25.254.3的访问页面

循环出现

0 0
原创粉丝点击