您的位置:首页 > 运维架构 > Apache

Linux:一台apache服务器上部署多个项目的apache配置

2015-10-13 10:54 741 查看
第一步:

将代码取到/var/www/html目录下(此为默认目录,具体看apache的设置);该目录下可以放多个项目,如:

[root@www html]# pwd
/var/www/html
[root@www html]# ls
bossmail.cn bossq.cn oem ydj.org yzhantong

第二步:

vim /usr/local/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>
DocumentRoot "/var/www/html/bossq.cn"
ServerName test.bossq.cn
ServerAlias bqapi.bossq.cn
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/html/ydj.org"
ServerName ydj.org
ServerAlias www.ydj.org
ErrorLog "logs/ydj.org-error_log"
CustomLog "logs/ydj.org-access_log" common
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/html/oem"
ServerName yzt241.com
ServerAlias www.yzt241.com
ErrorLog "logs/oem-error_log"
CustomLog "logs/oem-access_log" common
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/html/yzhantong"
ServerName cnh.cn
ServerAlias www.cnh.cn
ErrorLog "logs/cnh.cn-error_log"
CustomLog "logs/cnh.cn-access_log" common
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/html/bossmail.cn"
ServerName bossmail.cn
ServerAlias test.bossmail.cn
ErrorLog "logs/cnh.cn-error_log"
CustomLog "logs/cnh.cn-access_log" common
</VirtualHost>

第三步:

本地电脑的hosts文件添加解析,如:

192.168.148.18 test.bossmail.cn

打开浏览器输入:test.bossmail.cn或者bossmail.cn即可访问
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: