关于ubuntu 下安装的php和apache2 如何配置多虚拟主个机

ubuntu 下 安装apache2 完成后apache

/etc/apache2/目录下是看不到httpd.confubuntu

由于被apache2.conf代替了. 不重要 ,只是名字不同而已服务器

默认状况下 访问127.0.0.1 是读取sites-available的conf配置的ide

为了支持 多个虚拟主机的配置咱们须要作如下操做ui

1.在apache2目录下 手动添加 extra 文件夹 ,并在extra 文件加下添加一个 httpd-vhost.conf文件spa

2.打开apache2.confrest

(1).修改code

<Directory />
    Options FollowSymLinks
    AllowOverride None
    #Require all denied //注释掉
    allow from all    //添加这个选项
</Directory>

(2).添加 Include extra/httpd-vhost.conf域名

3.在httpd-vhost.conf中 添加虚拟主机 示例:it

<VirtualHost *:80>
ServerName   localhost.fis3
DocumentRoot  /home/spademan/mypro/fis/fis3/
ErrorLog    /logs/localhost.fis3-error.log
CustomLog   /logs/localhost.fis3-access.log  combined
</VirtualHost>

4.重启服务器 sudo apache apache2ctl restart //或者 sudo apachectl restart

5.配置hosts,便可用虚拟域名访问

相关文章
相关标签/搜索