12.10

来源:互联网 发布:雷劈数算法 编辑:程序博客网 时间:2024/05/22 13:32
####虚拟网址的证书加密####
前提:安装证书,虚拟网址配置正确。
虚拟网址的配置文件修改
  1 <Virtualhost *:80>
  2         Servername news.westos.com
  3         RewriteEngine on
  4         RewriteRule ^(/.*)$ https://%{HTTP_HOST}$1 [redirect=301]
  5 </Virtualhost>
  6 <Directory "/var/www/virtual/news.westos.com/html">
  7         Require all granted
  8 </Directory>
  9 <Virtualhost *:443>
 10         ServerName news.westos.com
 11         DocumentRoot /var/www/virtual/news.westos.com/html
 12         Customlog logs/news-443.log combined
 13         SSLEngine on
 14         SSLCertificateFile /etc/pki/tls/certs/www.westos.com.crt
 15         SSLCertificateKeyFile /etc/pki/tls/private/www.westos.com    .key
 16 </Virtualhost>

systemctl restart httpd        ##重启httpd服务
###php###
/var/www/html下
vim index.php
  1 <?php
  2 phpinfo ();
  3 ?>
###cgi###
关闭防火墙
/var/www/html下
mkdir cgi
cd cgi
vim index.cgi
  1 #!/usr/bin/perl
  2 print "Content-type: text/html\n\n";
  3 print `date`;        ##在manual上找到的
chmod +x index.cgi
semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/html/cgi(/.*)?'                ##修改标签(cgi/index.cgi)
restorecon -RvvF /var/www/html/cgi/    ##刷新是标签生效

perl index.cgi            ##查看index.cgi的执行结果

vim /etc/httpd/conf.d/default.conf
  1 <Virtualhost _default_:80>
  2         Documentroot /var/www/html
  3         Customlog "logs/default.log" combined
  4 </Virtualhost>
  5 <Directory "/var/www/html/cgi">
  6     Options +ExecCGI        ##
  7     AddHandler cgi-script .cgi    ##在manual上找到的
  8 </Directory>
systemctl restart httpd        ##重启httpd

##########################################################################
vim /etc/my.cnf
[mysqld]下加上语句skip-networking=1    ##关闭3306端口,不能使数据库暴露在网络中
###########################################################################
####论坛的搭建####
将Discuz_X3.2_SC_UTF8.zip下载到/var/www/html
unzip Discuz_X3.2_SC_UTF8.zip    ##解压会生成文件夹upload
chmod +x upload/
systemctl start mariadb
setenforce 0        ##更改selinux的状态
用http访问upload进行安装论坛
##yum install php-mysql.x86_64 -y  数据库与php的支持##

####正向代理####
服务器中的配置:
yum install squid -y        ##安装squid
vim /etc/squid/squid.conf
http_access allow all        ##修改squid的配置文件
systemctl start squid.service
systemctl stop firewalld.service
客户端的配置:
在浏览器中Preferences中的Advanced->Network->Settings填写你配置好的代理服务器

####反向代理####
服务器端设置:
yum remove httpd squid.x86_64 -y
yum install squid -y
vim /etc/squid/squid.conf
 56 http_access allow all
 59 http_port 80 vhost vport
 60 cache_peer 172.25.254.4 parent 80 0 no-query originserver round-robin name=w    eb1
 61 cache_peer 172.25.254.3 parent 80 0 no-query originserver round-robin name=w     eb2
 62 cache_peer_domain web1 web2 www.taobao.com
systemctl restart squid
关闭防火墙
客户端设置:
vim /etc/hosts
服务器ip www.taobao.com
然后用客户端浏览器访问www.taobao.com

####用户级的变量设置####
在家目录下
vim .bash_profile        ##example:export a=1
source .bash_profile
vim /etc/profile
source /etc/profile

0 0