1.进入阿里云控制台->域名->云解析DNS

2.点击解析设置配置虚拟主机

3.添加解析

配置虚拟主机

4.按要求填写

配置虚拟主机

5.这里域名就已经解析好的,然后开始下一步,进入/etc/httpd/conf/httpd.conf

6.找到这行 DocumentRoot "erroy.cn",屏蔽它,并保存

7.在/etc/httpd/conf.d目录下 创建一个文件 virtualhost.conf(名字可以随意英文)

8.virtualhost.conf文件内容为 

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName ysw.erroy.cn
     DocumentRoot "/home/www/ysw.erroy.cn"
     DirectoryIndex index.php
        CustomLog logs/ysw.erroy.log combined
     <Directory "/home/www/ysw.erroy.cn">
      Options -Indexes +FollowSymlinks
      AllowOverride All
      Require all granted
     </Directory>
</VirtualHost>

配置虚拟主机

9.重启httpd service httpd restart

10.然后再在 /home/www/ysw.erroy.cn/添加一个index.html的索引文件,内容随便写,在浏览器输入 ysw.erroy.cn 就可以访问了

相关文章:

猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案