Apache's virtual host encryption and Apache web rewrite
Configure the underlying virtual host for cryptographic authentication
(Virtual host news.westos.com)
Cd/etc/httpd/conf.d
Vim news.conf
<virtualhost *:80>
Servername news.westos.com
Documentroot/var/www/virtual/news.westos.com/html
Customlog Logs/news.log combined
</Virtualhost>
<directory "/var/www/virtual/news.westos.com/html" >
Require all granted
</Directory>
<virtualhost *:443> can access 443 ports (HTTPS port)
Servername news.westos.com Host Name
Documentroot/var/www/virtual/news.westos.com/html
Customlog Logs/news-443.log Combined Error
Sslengine on
SSLCERTIFICATEFILE/ETC/PKI/TLS/CERTS/WWW.WESTOS.COM.CRT Certificate
Sslcertificatekeyfile/etc/pki/tls/private/www.westos.com.key Key
</Virtualhost>
Systemctl Restart httpd Restart Service
"HTTP access can also be accessed https"
Page rewriting
Vim news.conf
<virtualhost *:80>
Servername news.westos.com
Rewriteengine on
Rewriterule ^ (/.*) $ https://%{http_host}$1 [redirect=301] Access HTTPS when HTTP is accessed
</Virtualhost>
<directory "/var/www/virtual/news.westos.com/html" >
Require all granted
</Directory>
<virtualhost *:443>
Servername news.westos.com
Documentroot/var/www/virtual/news.westos.com/html
Customlog Logs/news-443.log combined
Sslengine on
Sslcertificatefile/etc/pki/tls/certs/www.westos.com.crt
Sslcertificatekeyfile/etc/pki/tls/private/www.westos.com.key
</Virtualhost>
Systemctl Restart httpd Restart Service
"https when access to HTTP or HTTPS is last accessed"
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/8B/8F/wKioL1hRRiTSr3bTAADSbc7M9E4039.png "title=" Screenshot from 2016-12-10 10-19-24.png "alt=" Wkiol1hrritsr3btaadsbc7m9e4039.png "/>
Apache PHP and CGI
Php:
cd/var/www/html/
Vim index.php
<?php
Phpinfo (); PHP Detection page
?>
Vim/etc/httpd/conf/httpd.conf
163 <ifmodule dir_module>
164 DirectoryIndex index.php index.html read PHP First
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/8B/8F/wKioL1hRRqXzYYk9AAG_q8ZiwqQ339.png "title=" Screenshot from 2016-12-10 10-36-38.png "alt=" Wkiol1hrrqxzyyk9aag_q8ziwqq339.png "/>
Yum Install php-y PHP
Systemctl Restart httpd Restart Service
Cgi:
mkdir CGI
LS CGI
Yum Install httpd-manual.noarch-y Installation Manual (find CGI required commands)
Vim index.cgi
#!/usr/bin/perl
print "content-type:text/html\n\n";
print ' Date ';
Perl index.cgi test CGI is available
chmod +x index.cgi Grant Execute permission
cd/etc/httpd/conf.d/
Vim default.conf
<virtualhost _default_:80>
Documentroot/var/www/html
Customlog "Logs/default.log" combined
</Virtualhost>
<directory "/var/www/html/cgi" > Read files
Options +execcgi have Execute permissions
AddHandler Cgi-script. CGI
</Directory>
Make a website
Yum Install mariadb-server.x86_64-y database service
Systemctl Start mariadb Open service
VIM/ETC/MY.CNF Database configuration file
Skip-networking=1 does not expose the database to the network
Mysql_secure_installation Database Base Configuration
Cd/var/www/html
Lftp 172.25.254.250 Get the files your site needs
Unzip Discuz_x3.2_sc_utf8.zip Decompression
chmod 777 upload/-R grant permissions as required
Yum Install php-mysql.x86_64-y installation Service
Systemctl Restart httpd Restart Service
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8B/93/wKiom1hRSC2gw8A1AAWwgfP_DkY743.png "title=" Screenshot from 2016-12-10 11-35-04.png "alt=" Wkiom1hrsc2gw8a1aawwgfp_dky743.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8B/8F/wKioL1hRSGSDNoXBAAQxYwp6BrM181.png "title=" Screenshot from 2016-12-10 11-36-19.png alt= "Wkiol1hrsgsdnoxbaaqxywp6brm181.png"/> Forward Proxy
Agent:
Yum Install squid-y installation Service
Vim/etc/squid/squid.conf
Http_access allows all Access
Cache dir UFS/VAR/SPOOL/SQUID 100 16 256
Systemctl Start Squid Start service
By the agent
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/8B/90/wKioL1hRSXOwByBPAAagXpc5Vxo934.png "title=" Screenshot from 2016-12-10 13-34-08.png "alt=" Wkiol1hrsxowbybpaaagxpc5vxo934.png "/>
Reverse Proxy
Service side:
Yum Install Squid installation Service (requires no HTTP)
Vim/etc/squid/squid.conf Modifying accessory files
Http_access allow everyone to access
57
# # Squid normally listens to port 3128
Http_port vhost Vport using 80 ports (virtual host virtual port)
Cache_peer 172.25.254.25 0 no-query Access IP parent Port neighbor Port does not use neighbor port
# Uncomment and adjust the following to add a disk cache directory.
Cache_dir UFS/VAR/SPOOL/SQUID 100 16 256 Cache location
Polling
Vim/etc/squid/suid.conf
Http_access Allow all
57
# # Squid normally listens to port 3128
Http_port Vhost Vport
Cache_peer 172.25.254.25 Parent 0 no-query originserver Round-robin name =web1 poll one IP
Cache_peer 172.25.254.24 Parent 0 no-query originserver Round-robin name =web2 poll two IP
Cache_peer_domain Web1 web2 www.westos.com poll for the domain name
Uncomment and adjust the following to add a disk cache directory.
Cache_dir UFS/VAR/SPOOL/SQUID 100 16 256
Linux Learning Notes