[Linux]Linux下Apache服务器配置
Linux下Apache服务器配置
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
(基于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>
[Linux]Linux下Apache服务器配置的更多相关文章
- Linux下Apache服务器配置
Linux下Apache服务器配置 相关包: httpd-2.2.3-29.e15.i386.rpm //主程序包 httpd-devel-2.2.3-29.e15.i ...
- MAC下 Apache服务器配置
今天做了一个注册登录提交的页面,后续操作需要用到后端的知识 php+Mysql,之前只是有些了解,现在开始具体操作了,首先从配置环境开始.查了好几篇文档与博客,了解了挺多知识. Mac下Apache服 ...
- 【linux】下Apache无法启动(8080端口被占用)
Linux下8080端口被占用,apache无法启动. 打开终端输入netstat -lnp|grep 8080 发现竟然是tcp6 占用里,因此ipv6启用占用了端口. 1.打开/etc/sysct ...
- Linux系统下 Apache+PHP 环境安装搭建
一.安装Apache2.2.221.到官网下载 http://httpd.apache.org/download.cgi ,选择相应的版本 可以先下载到windows系统中,上传到linux, 也可 ...
- linux环境下Apache+Tomcat集群配置
写在前面 apache配置多个tomcat,实现请求分流,多个tomcat服务均衡负载,增加服务的可靠性.最近研究了一下,遇到许多问题,记录一下,方便以后查阅,不喜欢apache,nginx也是可以做 ...
- Linux环境下Apache ActiveMQ 基本安装
原文链接:https://www.jianshu.com/p/1c017088aa95 在linux上安装mq,并映射到外网.1.Apache ActiveMQ安装基本条件请参考链接:2.下载Apac ...
- linux系统下apache服务的启动、停止、重启命令
本文章简单的介绍了关于linux下在利用命令来操作apache的基本操作如启动.停止.重启等操作,对入门者不错的选择.本文假设你的apahce安装目录为 usr local apache2,这些方法适 ...
- Linux环境下Apache反向代理金蝶中间件Apusic集群
操作系统:RedHat Enterprise Linux 5.6 文档参考:<金蝶Apusic应用服务器 帮助手册| IX. Apusic Http Server使用指南> 一.金蝶中间件 ...
- 基于Linux系统下Apache服务器的安装部署
企业中常用的web服务,用来提供http://(超文本传输协议). web系统是客户端/服务器模式的,所以应该有服务器和客户端里两个部分.常用的服务器程序时Apache,常用的客户端程序是浏览器.ww ...
随机推荐
- Asp.net core 学习笔记 ( Router 路由 )
和之前的一样用法. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory log ...
- MySql常用函数全部汇总
MySQL数据库中提供了很丰富的函数.MySQL函数包括数学函数.字符串函数.日期和时间函数.条件判断函数.系统信息函数.加密函数.格式化函数等.通过这些函数,可以简化用户的操作.例如,字符串连接函数 ...
- SOCKET 接收图片
using System;using System.Collections.Generic;using System.Text;using System.Net.Sockets;using Syste ...
- 雷林鹏分享:XML DOM
XML DOM DOM(Document Object Model 文档对象模型)定义了访问和操作文档的标准方法. XML DOM XML DOM(XML Document Object Model) ...
- linux搭建DHCP
动态主机配置协议(DHCP,Dynamic Host Configuration Protocol),该协议用于自动管理局域网内主机的IP地址.子网掩码.网关地址及DNS地址等参数,可以有效地提升IP ...
- tomcat8.5 优化
第一步:配置user登录tomcat 参考:https://www.cnblogs.com/kevincaptain/p/10370794.html 第二步:性能优化 2.1tomcat的运行模式有3 ...
- 解决audio 在部分移动端浏览器不能自动播放(目前包括ios、微博)
问题描述:项目需要在页面加载完成后自动播放音乐,但在ios中却无法自动播放,需要用户主动触发 解决办法: $('html').one('touchstart',function(){ document ...
- python 小练习 5
Py从小喜欢奇特的东西,而且天生对数字特别敏感,一次偶然的机会,他发现了一个有趣的四位数2992, 这个数,它的十进制数表示,其四位数字之和为2+9+9+2=22,它的十六进制数BB0,其四位数字之和 ...
- MySQL_插入更新 ON DUPLICATE KEY UPDATE
平时我们在设计数据库表的时候总会设计 unique 或者 给表加上 primary key 的限制条件. 此时 插入数据的时候 ,经常会有这样的情况: 我们想向数据库插入一条记录: 若数据表中存在以 ...
- [luogu P3275] [SCOI2011]糖果
[luogu P3275] [SCOI2011]糖果 题目描述 幼儿园里有N个小朋友,lxhgww老师现在想要给这些小朋友们分配糖果,要求每个小朋友都要分到糖果.但是小朋友们也有嫉妒心,总是会提出一些 ...