【在linux中】linux中openSUSE 的 Apache配置步骤详解

更新时间:2019-08-19    来源:apache    手机版     字体:

【www.bbyears.com--apache】

DNS 绑定 A 记录#

首先在 DNS 上创建 A 记录,将域名绑定到相应 IP 上。
创建站点目录#

在服务器上,添加 /srv/www/vhosts/www.111cn.net 目录,并在该目录下创建一个 index.html 文件 – 用于测试。
配置 Apache#

创建虚拟主机配置文件#

 代码如下 $ cd /etc/apache2/vhosts.d
$ sudo cp vhost.template www.111cn.net.conf

修改 www.111cn.net.conf 文件内容如下:

 代码如下


    ServerName www.111cn.net
    ServerAdmin chenxsan@gmail.com

    DocumentRoot /srv/www/vhosts/www.111cn.net

    ErrorLog /var/log/apache2/www.111cn.net-error_log
    CustomLog /var/log/apache2/www.111cn.net-access_log combined

    # don"t loose time with IP address lookups
    HostnameLookups Off

    # needed for named virtual hosts
    UseCanonicalName Off

    # configures the footer on server-generated documents
    ServerSignature On

    #
    # This should be changed to whatever you set DocumentRoot to.
    #
   
        AllowOverride All
        Options FollowSymLinks

        Order allow,deny
        Allow from all

   

之后重启 Apache:

$ sudo rcapache2 restart

访问 www.111cn.net 网址,已经可以看到 index.html 文件的内容了。如果我们之前未添加 index.html 文件,访问的话,则会出现如下错误信息:
Access forbidden!
You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
www.111cn.net

本文来源:http://www.bbyears.com/jiaocheng/63013.html

热门标签

更多>>

本类排行