linux 的常用命令---------第十五阶段(Apache与LAMP架构)
Apache与LAMP架构 ? 一、认识apache apache介绍: http超文本协议 URI:统一资源标识符? ? ? ? ? ? ? URL:统一资源定位符(其中URI包含着URL) 在URL统一资源定位符中包含:http:// www.hcy.com.cn:80/admin/index.php 解释为: http://? ? ? ? ? ? 为安全连接字,就是一种协议 www.hcy.com.cn? ? ? ? ?为域名 ? ?:80? ? ? ? ? ? ? ? 为 http对应端口(https对应端口为443) /admin/index.php? ? ? ?为网址目录和文件名 ? LAMP安装说明: 源码安装(推荐):安全、稳定、高效率 二进制yum命令安装(不推荐):版本低 ? Apache的三种工作模式: prefork模式:是一个进程处理一个用户请求 worker模式:是一个进程中包含多个子进程,然后用一个子进程处理一个用户请求 event模式: 是在worker模式基础上,解决了长期被占用子程序进程浪费资源的问题 ? apache的基本信息:apache为企业供了web服务,提供http://(超文本传输协议)。 主配置目录:? /etc/httpd/conf 主配置文件:? /etc/httpd/conf/http.conf 子配置目录:? /etc/httpd/conf.d 子配置文件:? ?/etc/httpd/conf.d/*.conf 默认发布目录:/var/www/html/? ?(用来存放发布网站信息的包) 默认发布文件:index.html (该文件为静态文件;其动态文件为:index.php) 默认端口:? ? 80端口 ? 服务器的返回值状态(表示请求是否成功等信息) 200? : ok? ?表示请求成功 304? : not modified? 表示标识一个缓存 403? : forbidden? 表示客户端没有访问权限(可能原因是由于防火墙没关) 404? : not found? 表示客户端请求资源不存在(找错:先检查网络根目录是否存在) 500? : internet server error? 表示服务器内部错误(解决办法:重启或过段时间就好了) ? LAMP介绍: LAMP = Linux +? Apache + Mysql/MariaDB + PHP/Perl/Python ? 二、Apache 编译安装:(或用yum install httpd -y 安装,一步到位即可) 安装依赖包: #yum install gcc gcc-c++? ncurses-devel?ncurses? pcre pcre-devel? openssl-devel? ?zlib-devel? -y 上传安装包: #ls #apr-1.5.2.tar.gz? apr-util-1.5.4.tar.gz? httpd-2.4.20.tar.gz 解压安装包: #tar xf?apr-1.5.2.tar.gz #tar xf?apr-util-1.5.4.tar.gz #tar xf?httpd-2.4.20.tar.gz 编译安装apr-1.5.2 #cd apr-1.5.2 #./configure --prefix=/usr/local/apr? ? ? ? ? ? ?表示用于检测所有依赖信息的,如果没问题就表示成功了。 #make? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?编译 #make install? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?安装 编译安装apr-util-1.5.4 #cd?apr-util-1.5.4 #./configure --with-apr=/usr/local/apr/ --prefix=/usr/local/apr-util #make && make install 编译安装apache #cd?httpd-2.4.20 #./configure? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?反斜杠含义:一行写不下,另一行接着写 >--prefix=/usr/local/httpd2.4/ > --sysconfdir=/etc/httpd2.4/conf/
> --enable-so
> --enable-ssl
> --with-apr=/usr/local/apr
> --with-apr-util=/usr/local/apr-util <VirtualHost *:81> DocumentRoot /var/www/ken1 代表一个虚拟机,虚拟机之间要用/隔开 DirectoryIndex index.html </VirtualHost>
<VirtualHost *:82>
DocumentRoot /var/www/ken2
DirectoryIndex index.html
</VirtualHost>
(2)基于域名的虚拟主机:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |