apache配置
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了apache配置,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3180字,纯文字阅读大概需要5分钟。
内容图文
例1:部门内搭建一台WEB服务器,采用的IP地址和端口为192.168.0.3:80,首页采用index.html文件。管理员E- mail地址为root@linuxidc.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@linuxidc.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@linuxidc.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@linuxidc.comErrorLog logs/ip2-error_logCustomLog logs/ip2-access_log common</Virtualhost>
(基于域名)mkdir /var/www/linuxidc /var/www/long //创建两个主目录编辑httpd.conf文件:<Virtualhost 192.168.0.3> //设置虚拟主机的IPDocumentRoot /var/www/linuxidc //设置虚拟主机的主目录DirectoryIndex index.html //设置主页文件ServerName www.linuxidc.com //设置虚拟主机完全域名ServerAdmin root@linuxidc.com //设置管理员邮箱ErrorLog logs/linuxidc-error_log //设置错误日志的存放位置CustomLog logs/linuxidc-access_log common //设置访问日志的存放位置</Virtualhost><Virtualhost 192.168.0.3>DocumentRoot /var/www/longDirectoryIndex index.htmlServerName www.linuxidc.com //设置虚拟主机完全域名ServerAdmin root@linuxidc.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@linuxidc.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@linuxidc.comErrorLog logs/port8090-error_logCustomLog logs/port8090-access_log common</Virtualhost>
Ubuntu Server 14.04 安装Web服务器(Linux+Apache+MySQL+PHP) http://www.linuxidc.com/Linux/2015-06/119061.htm
Linux下安装配置PHP环境(Apache2) http://www.linuxidc.com/Linux/2015-05/118062.htm
Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置 http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm
RedHat 5.4下Web服务器架构之源码构建LAMP环境及应用PHPWind http://www.linuxidc.com/Linux/2012-10/72484p2.htm
Linux下Apache虚拟主机的配置 http://www.linuxidc.com/Linux/2016-04/130381.htm
http://www.linuxidc.com/Linux/2016-06/132025.htm
原文:https://www.cnblogs.com/nyfz/p/8351042.html
内容总结
以上是互联网集市为您收集整理的apache配置全部内容,希望文章能够帮你解决apache配置所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。