考试
2019-12-28 11:54:18来源:博客园 阅读 ()
考试
配置虚拟主机
vi /usr/local/apache2.4/conf/httpd.conf
搜索httpd-vhost,删除行首#号
vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin admin@gmd.com
DocumentRoot "/data/wwwroot/gmd.com"
ServerName gmd.com
ErrorLog "logs/gmd.com-error_log"
CustomLog "logs/gmd.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/www.test0920.com"
ServerName www.test0920.com
</VirtualHost>
退出保存
mkdir -p /data/wwwroot/gmd.com data/wwwroot/www.test0920.com
echo "www.0920.com" > /data/wwwroot/www.test0920.com/index.html
echo "gmd.com" > /data/wwwroot/gmd.com/index.html
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
关闭防火墙
systemctl stop firewalld
到真实电脑上修改hosts
最后一行加上
192.168.89.128 www.test0920.com
域名跳转
vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/www.test0920.com"
ServerName www.test0920.com
ServerAlias test0920.com
ServerAlias testdomain.com
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.test0920.com$
RewriteRule ^/(.*)$ http://www.test0920.com/$1 [R=301,L]
</IfModule>
</VirtualHost>
vi /usr/local/apache2.4/conf/httpd.conf
搜索rewrite,行首#号删除
/usr/local/apache2.4/bin/apachectl graceful
/usr/local/apache2.4/bin/apachectl -M|grep -i rewrite
curl -x127.0.0.1:80 -I test0920.com
curl -x127.0.0.1:80 -I testdomain.com
出现301
用户认证
vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/www.test0920.com"
ServerName www.test0920.com
ServerAlias test0920.com
ServerAlias testdomain.com
<Directory /data/wwwroot/www.test0920.com>
AllowOverride AuthConfig
AuthName "www.test0920.com user auth"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
</Directory>
</VirtualHost>
创建用户
/usr/local/apache2.4/bin/htpasswd -cm /data/.htpasswd xmcz
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
访问控制(IP)
vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
编辑
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/www.test0920.com"
ServerName www.test0920.com
ServerAlias test0920.com
ServerAlias testdomain.com
<Directory /data/wwwroot/www.test0920.com/download/dw01.php>
Order deny,allow
Deny from all
Allow from 192.168.89.128
</Directory>
</VirtualHost>
保存
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
mkdir /data/wwwroot/www.test0920.com/download
cd /data/wwwroot/www.test0920.com/download
vi dw01.php
<?php
echo"22"
?>
curl -x127.0.0.1:80 -I www.test0920.com/download/dw01.php -uxmcz:123456
访问控制(限制解析)
vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/www.test0920.com"
ServerName www.test0920.com
ServerAlias test0920.com
ServerAlias testdomain.com
<Directory /data/wwwroot/www.test0920.com/upload>
php_admin_flag engine off
</Directory>
</VirtualHost>
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
mkdir /data/wwwroot/www.test0920.com/upload
cd /data/wwwroot/www.test0920.com/upload
vi up01.php
<?php
echo"123"
?>
访问控制(用户)
vi /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/www.test0920.com"
ServerName www.test0920.com
ServerAlias test0920.com
ServerAlias testdomain.com
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*curl.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} .*baidu.com.*[NC]
RewriteRule .* - [F]
</IfModule>
</VirtualHost>
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
curl -A "11" -x127.0.0.1:80 -I www.test0920.com
模块加载
cd /usr/local/src/
yum install -y wget
wget http://pecl.php.net/get/redis-2.2.5.tgz
tar -zxvf redis-2.2.5.tgz
cd redis-2.2.5
yum install -y autoconf
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
/usr/local/php/bin/php -i |grep extension_dir
ls /usr/local/php/lib/php/extensions/no-debug-zts-20131226
vi /usr/local/php/etc/php.ini
最后一行加
extension=redis.so
/usr/local/php/bin/php -m |grep redis
原文链接:https://www.cnblogs.com/tui463/p/12111682.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- 树莓派4 (8GB) RaspiOS 64 bit 入手配置流程 2020-06-10 2020-06-11
- windows10安装配置WSL(Ubuntu) 2020-06-07
- 简单安装配置samba服务器 2020-06-03
- MPI 本地局域网运行多机配置,同时运行多个程序; 2020-06-02
- Xshell如何配置并远程连接Linux服务器详解 2020-05-31
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash