北京SEO

linux中openSUSE 的 Apache配置步骤详解

2019/10/10/17:45:48  阅读:1889  来源:谷歌SEO算法  标签: Google

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

DNS 绑定 A 记录#

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

创建站点目录#

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

配置 Apache#

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

  1. $cd/etc/apache2/vhosts.d
  2. $sudocpvhost.templatewww.phpfensi.com.conf

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

  1. <VirtualHost*:80>
  2. ServerNamewww.phpfensi.com
  3. ServerAdminchenxsan@gmail.com
  4. DocumentRoot/srv/www/vhosts/www.phpfensi.com
  5. ErrorLog/var/log/apache2/www.phpfensi.com-error_log
  6. CustomLog/var/log/apache2/www.phpfensi.com-access_logcombined
  7. #don'tloosetimewithIPaddresslookups
  8. HostnameLookupsOff
  9. #neededfornamedvirtualhosts
  10. UseCanonicalNameOff
  11. #configuresthefooteronserver-generateddocuments
  12. ServerSignatureOn
  13. #
  14. #ThisshouldbechangedtowhateveryousetDocumentRootto.
  15. #
  16. <Directory"/srv/www/vhosts/www.phpfensi.com">
  17. AllowOverrideAll
  18. OptionsFollowSymLinks
  19. Orderallow,deny
  20. Allowfromall
  21. </Directory>
  22. </VirtualHost>

之后重启 Apache:

$ sudo rcapache2 restart

访问 www.phpfensi.com 网址,已经可以看到 index.html 文件的内容了,如果我们之前未添加 index.html 文件,访问的话,则会出现如下错误信息:

  1. Accessforbidden!
  2. Youdon’thavepermissiontoaccesstherequesteddirectory.Thereiseithernoindexdocumentorthedirectoryisread-protected.
  3. Ifyouthinkthisisaservererror,pleasecontactthewebmaster.
  4. Error403
  5. www.phpfensi.com

广告内容

linux中openSUSE 的 Apache配置步骤详解 linux中openSUSE 的 Apache配置步骤详解 linux中openSUSE 的 Apache配置步骤详解

相关阅读

热门评论

小浪SEO博客 小浪SEO博客

专注SEO优化思维、SEO技术的实战分享类博客~

总篇数183

精选文章

RMAN中catalog和nocatalog区别介绍 小技巧:为Linux下的文件分配多个权限 zimbra8.5.1安装第三方签名ssl证书的步骤 解决mysql不能远程连接数据库方法 windows服务器mysql增量备份批处理数据库 mysql中slow query log慢日志查询分析 JavaScript跨域问题总结 Linux下负载均衡软件LVS配置(VS/DR)教程 mysql中权限参数说明 MYSQL(错误1053)无法正常启动

SEO最新算法