20170830L08-06老男孩linux实战运维培训-Lamp系列之-Apache服务生产实战应用指南03

简介:

还是说的apache的设置

这一次说的是虚拟主机

主要配置文件

httpd.conf

httpd-vhhsots.conf


httpd.conf主要控制目录的访问


httpd-vhosts.conf控制域名的转换,要别名,日志的路径


对于实验中的访问主机中要设置 hosts文件

<Directory "/var/bbs">

    #

    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

    #

    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.

    #

    # The Options directive is both complicated and important.  Please see

    # http://httpd.apache.org/docs/2.4/mod/core.html#options

    # for more information.

    #

    Options  FollowSymLinks


    #

    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   AllowOverride FileInfo AuthConfig Limit

    #

    AllowOverride None


    #

    # Controls who can get stuff from this server.

    #

    Require all granted

</Directory>


httpd-vhosts.conf主要设置字段

<VirtualHost *:80>

    ServerAdmin xxxxxxx@qq.com

    DocumentRoot "/var/blog"

    ServerName blog.arthur.com

    ServerAlias arthur.com

    ErrorLog "logs/blog-error_log"

    CustomLog "logs/blog-access_log" common

</VirtualHost>



<VirtualHost *:80>

    ServerAdmin xxxxxxx@qq.com

    DocumentRoot "/var/bbs"

    ServerName bbs.arthur.com

    ServerAlias arthur.com

    ErrorLog "logs/bbs-error_log"

    CustomLog "logs/bbs-access_log" common

</VirtualHost>


还有记得打开Include权限,也就是虚拟主机权限

# Virtual hosts

Include conf/extra/httpd-vhosts.conf            #去掉前面的注释


命令嘛学了就要用,不用就不熟

 sed -i 's#\#Include conf/extra/httpd-vhosts.conf#Include conf/extra/httpd-vhosts.conf#' /usr/local/apache/conf/httpd.conf


 echo 'i am oldboy! my blog is http://blog.arthur.com' >/var/blog/index.html



     本文转自wangchangshu2 51CTO博客,原文链接:http://blog.51cto.com/398528/1961169,如需转载请自行联系原作者





相关文章
|
28天前
|
Linux
linux查看应用对应的端口
linux查看应用对应的端口
16 0
|
28天前
|
网络协议 安全 Linux
linux系统安全及应用——端口扫描
linux系统安全及应用——端口扫描
36 0
|
8天前
|
存储 关系型数据库 MySQL
Linux服务详解
Linux服务详解
22 0
|
9天前
|
网络协议 Ubuntu Linux
Linux 下 TFTP 服务搭建及 U-Boot 中使用 tftp 命令实现文件下载
Linux 下 TFTP 服务搭建及 U-Boot 中使用 tftp 命令实现文件下载
|
15天前
|
Linux Apache
CentOS 7 源码安装LAMP环境源 和apache监听别的端口
CentOS 7 源码安装LAMP环境源 和apache监听别的端口
12 0
|
16天前
|
监控 Java Linux
linux下监控java进程 实现自动重启服务
linux下监控java进程 实现自动重启服务
|
19天前
|
关系型数据库 MySQL Linux
linux特定服务日志
Linux系统的服务日志在`/var/log`目录下,如系统日志(`/var/log/syslog`或`/var/log/messages`)、认证日志(`/var/log/auth.log`)、SSH日志(`/var/log/auth.log`或`/var/log/secure`)。Web服务器(Apache和Nginx)的访问和错误日志、MySQL错误日志、Postfix及Dovecot邮件服务器日志也在此处。日志位置可能因发行版和服务配置而异,不确定时可查服务配置或用`grep`搜索。使用`logrotate`可管理日志文件大小。
20 6
|
21天前
|
Ubuntu Linux Apache
linux下apache2更换目录
linux下apache2更换目录
|
23天前
|
Linux 测试技术 C语言
【Linux】应用编程之C语言文件操作
【Linux】应用编程之C语言文件操作
|
26天前
|
Linux
linux中服务管理
在Linux服务管理中,从传统的System V init到Upstart,再到广泛采用的systemd,管理方式不断发展。systemd以其强大的功能和依赖解决成为现代Linux的核心。`systemctl`是管理服务的关键命令,如启动(`start`)、停止(`stop`)、重启(`restart`)服务及设置开机启动(`enable`)或取消(`disable`)。了解和服务管理,特别是systemd和`systemctl`的使用,对系统管理员至关重要。其他如xinetd用于控制网络服务,而特定环境下有OpenRC等工具。
17 2