1 min read

openSUSE 的 Apache 配置

我的目的,是在 openSUSE 13.1 系统下,配置 Apache 服务器绑定 en.zfanw.com 域名。

DNS 绑定 A 记录

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


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

配置 Apache


$ cd /etc/apache2/vhosts.d
$ sudo cp vhost.template en.zfanw.com.conf

修改 en.zfanw.com.conf 文件内容如下:

<VirtualHost *:80>
    ServerName en.zfanw.com
    ServerAdmin chenxsan@gmail.com

    DocumentRoot /srv/www/vhosts/en.zfanw.com

    ErrorLog /var/log/apache2/en.zfanw.com-error_log
    CustomLog /var/log/apache2/en.zfanw.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/en.zfanw.com">
        AllowOverride All
        Options FollowSymLinks

        Order allow,deny
        Allow from all



之后重启 Apache:

$ sudo rcapache2 restart

访问 en.zfanw.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


报告问题 修订

如果你有自建 https 代理的需求,欢迎尝试 Phantom,一键搭建,方便快捷。查看 demo