加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

linux中openSUSE 的 Apache配置过程详解

发布时间:2023-07-22 13:13:22 所属栏目:Linux 来源:
导读:本文章介绍的目的就是实现在 openSUSE 13.1 系统下,配置 Apache 服务器绑定 www.Cuoxin.com二级域名,具体配置步骤如下.DNS 绑定 A 记录#首先在 DNS 上创建 A 记录,将域名绑定到相应 IP 上.创建站点目录#在服务器上,添

本文章介绍的目的就是实现在 openSUSE 13.1 系统下,配置 Apache 服务器绑定 www.Cuoxin.com二级域名,具体配置步骤如下.

DNS 绑定 A 记录#

首先在 DNS 上创建 A 记录,将域名绑定到相应 IP 上.

创建站点目录#

在服务器上,添加 /srv/www/vhosts/www.Cuoxin.com 目录,并在该目录下创建一个 index.html 文件 – 用于测试.

配置 Apache#

创建虚拟主机配置文件#,代码如下:

$ cd /etc/apache2/vhosts.d 

$ sudo cp vhost.template www.Cuoxin.com.conf 

修改 www.Cuoxin.com.conf 文件内容如下:

<VirtualHost *:80> 

    ServerName www.Cuoxin.com 

    ServerAdmin chenxsan@gmail.com 

    DocumentRoot /srv/www/vhosts/www.Cuoxin.com 

    ErrorLog /var/log/apache2/www.Cuoxin.com-error_log 

    CustomLog /var/log/apache2/www.Cuoxin.com-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. 

    # 

    <Directory "/srv/www/vhosts/www.Cuoxin.com"> 

        AllowOverride All 

        Options FollowSymLinks 

        Order allow,deny 

        Allow from all 

    </Directory> 

</VirtualHost> 

之后重启 Apache:

$ sudo rcapache2 restart

访问 www.Cuoxin.com 网址,已经可以看到 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.Cuoxin.com

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章