Apache服务器配置--Linux
来源:互联网 发布:淘宝网能用货到付款 编辑:程序博客网 时间:2024/06/06 17:07
httpd-2.2.3-29.e15.i386.rpm //主程序包httpd-devel-2.2.3-29.e15.i386.rpm //开发程序包httpd-manual-2.2.3-29.e15.i386.rpm //手册文档system-config-httpd-1.3.3.3-1.e15.noarch.rpm //配置工具注:安装时会出现依赖包问题,可用YUM安装来解决启用时需要配置防火墙来放行
开机自动加载:
chkconfig --level 3 httpd on
配置实例:
例1:部门内搭建一台WEB服务器,采用的IP地址和端口为192.168.0.3:80,首页采用index.html文件。管理员E-mail地址为root@sales.com,网页的编码类型采用GB2312,所有网站资源都存放在/var/www/html目录下,并将Apache的根目录设置为/etc/httpd目录。编辑主配置文件httpd.confvim /etc/httpd/conf/httpd.conf //编辑主配置文件ServerRoot "/etc/httpd" //设置Apache的主目录Timeout 120 //设置请求超时Listen 80 //设置监听端口ServerAdmin root@sales.com //设置管理员邮箱ServerName 192.168.0.3:80 //设置主机或IPDocumentRoot "/var/www/html" //设置Apache文档目录DirectoryIndex index.html //设置主页文件AddDefaultCharset GB2312 //设置网站编码编辑主页文件用作测试:cd /var/www/htmlecho "This is web test sample.">>index.htmlchmod 705 index.html重新加载服务:service httpd restar
例2:假设Apache服务器具有192.168.0.2和19.16.0.3两个地址,然后配置Apache,把多个网站绑定在不同的IP地址上,访问服务器上不同的IP地址,就可以看到不同的网站。
(基于IP)mkdir /var/www/ip1 /var/www/ip2 //创建两个主目录编辑httpd.conf文件:<Virtualhost 192.168.0.2> //设置虚拟主机的IPDocumentRoot /var/www/ip1 //设置虚拟主机的主目录DirectoryIndex index.html //设置主页文件ServerAdmin root@sales.com //设置管理员邮箱ErrorLog logs/ip1-error_log //设置错误日志的存放位置CustomLog logs/ip1-access_log common //设置访问日志的存放位置</Virtualhost><Virtualhost 192.168.0.3> //设置相应的IPDocumentRoot /var/www/ip2DirectoryIndex index.htmlServerAdmin root@sales.comErrorLog logs/ip2-error_logCustomLog logs/ip2-access_log common</Virtualhost>
(基于域名)mkdir /var/www/smile /var/www/long //创建两个主目录编辑httpd.conf文件:<Virtualhost 192.168.0.3> //设置虚拟主机的IPDocumentRoot /var/www/smile //设置虚拟主机的主目录DirectoryIndex index.html //设置主页文件ServerName www.smile.com //设置虚拟主机完全域名ServerAdmin root@sales.com //设置管理员邮箱ErrorLog logs/smile-error_log //设置错误日志的存放位置CustomLog logs/smile-access_log common //设置访问日志的存放位置</Virtualhost><Virtualhost 192.168.0.3>DocumentRoot /var/www/longDirectoryIndex index.htmlServerName www.smile.com //设置虚拟主机完全域名ServerAdmin root@sales.comErrorLog logs/long-error_logCustomLog logs/long-access_log common</Virtualhost>
(基于端口)mkdir /var/www/port8080 /var/www/port8090 //创建两个主目录编辑httpd.conf文件:Listen 8080Listen 8090<Virtualhost 192.168.0.3:8080> //设置相应的端口DocumentRoot /var/www/port8080 //设置虚拟主机的主目录DirectoryIndex index.html //设置主页文件ServerAdmin root@sales.com //设置管理员邮箱ErrorLog logs/port8080-error_log //设置错误日志的存放位置CustomLog logs/port8080-access_log common //设置访问日志的存放位置</Virtualhost><Virtualhost 192.168.0.3:8090> //设置相应的端口DocumentRoot /var/www/port8090DirectoryIndex index.htmlServerAdmin root@sales.comErrorLog logs/port8090-error_logCustomLog logs/port8090-access_log common</Virtualhost>
0 0
- Apache服务器配置(Linux)
- Linux配置Apache服务器
- Apache服务器配置--Linux
- [Linux]Apache服务器配置技巧
- Linux下配置Apache服务器
- Linux虚拟机Apache服务器配置
- Linux下Apache服务器的配置!
- Linux下的Apache服务器配置小记
- LINUX/APACHE/MYSQL/PHP服务器配置
- Linux中Apache服务器的基本配置
- Linux配置Apache服务器全攻略
- linux配置www服务器 (apache)
- Linux配置WWW服务器全攻略 ( apache )
- Linux Apache Web服务器配置教程
- [apache] Linux全能web服务器配置方案
- Linux配置Apache服务器全攻略
- Linux下Apache http 服务器安装配置
- Linux配置Apache服务器全攻略
- Linux环境变量的设置和查看
- centos上安装和配置tomcat
- Rmi工作原理的理解
- 学习js运动多个物体宽度变化笔记
- 回文判断
- Apache服务器配置--Linux
- 数据结构之平衡树(Treap)
- eclipse 提交项目至 github
- 并查集详解(转)
- 使用 Swift 与 Kitura 构建端到端的云应用程序
- leetcode 27. Remove Element
- 数据还原
- Java迭代器注意事项
- Centos安装中文输入法