资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何进行源码编译搭建LAMP环境

这篇文章将为大家详细讲解有关如何进行源码编译搭建LAMP环境,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

创新互联一直秉承“诚信做人,踏实做事”的原则,不欺瞒客户,是我们最起码的底线! 以服务为基础,以质量求生存,以技术求发展,成交一个客户多一个朋友!为您提供网站建设、成都网站制作、成都网页设计、成都小程序开发、成都网站开发、成都网站制作、成都软件开发、手机APP定制开发是成都本地专业的网站建设和网站设计公司,等你一起来见证!

实战内容:搭建一个虚拟主机,并且演示三种不同情况的浏览效果

1.开启虚拟主机

如何进行源码编译搭建LAMP环境

2.

方法1:通过不同的IP地址,解析不同域名

服务器增加IP(另一个域名解析出来的那个IP)。

 

[root@xuegod60 conf]# ifconfigeth0:1 192.168.10.90 netmask 255.255.255.0 #添加一个ip

[root@xuegod60 conf]# mkdir -p/var/www/html/bbs                   #创建一个bbs目录

[root@xuegod60 conf]# echo"bbs.192.168.10.90" >/var/www/html/bbs/index.html

[root@xuegod60 conf]# ping192.168.10.90

PING 192.168.10.90(192.168.10.90) 56(84) bytes of data.

64 bytes from 192.168.10.90:icmp_seq=1 ttl=64 time=0.042 ms

 

 

修改httpd.conf

#vim httpd.conf   在文件的最后,添加以下内容

    ServerAdminwebmaster@dummy-host.example.com

    DocumentRoot/var/www/html/

    ServerNamedummy-host.example.com

    ErrorLoglogs/dummy-host.example.com-error_log

    CustomLoglogs/dummy-host.example.com-access_log common

    ServerAdminwebmaster@dummy-host.example.com

    DocumentRoot/var/www/html/bbs/

    ServerNamedummy-host.example.com

    ErrorLoglogs/dummy-host.example.com-error_log

    CustomLoglogs/dummy-host.example.com-access_log common

测试:

[root@xuegod60 conf]# service httpd restart

http://192.168.10.60/

如何进行源码编译搭建LAMP环境

http://192.168.10.90/

如何进行源码编译搭建LAMP环境

方法二:通过不同域名:

在域名管理后台,修改DNS配置,www.xuegod.com与bbs.xuegod.com解析成相同的IP。

修改httpd.conf

#vim httpd.conf

    ServerAdminwebmaster@dummy-host.example.com

    DocumentRoot/var/www/html/

    ServerName www.xuegod.com

    ErrorLog logs/www.xuegod.com-error_log

    CustomLog logs/www.xuegod.com-access_logcommon

    ServerAdminwebmaster@dummy-host.example.com

    DocumentRoot /var/www/html/bbs/

ServerName  bbs.xuegod.com

ErrorLog logs/bbs.xuegod.com-error_log

    CustomLog logs/bbs.xuegod.com-access_log common

在windows下windows  hosts文件在:   C:\Windows\System32\drivers\etc

192.168.10.60 www.xuegod.com

192.168.10.60 bbs.xuegod.com

测试:

[root@xuegod60 conf]# servicehttpd restart

www.xuegod.com

如何进行源码编译搭建LAMP环境

bbs.xuegod.com

如何进行源码编译搭建LAMP环境

方法3:基于端口配置虚拟主机:

[root@xuegod60 conf]# vim /etc/httpd/conf/httpd.conf  

添加90端口

如何进行源码编译搭建LAMP环境

    ServerAdminwebmaster@dummy-host.example.com

    DocumentRoot/var/www/html/

    ServerNamewww.example.com

    ErrorLoglogs/www.example.com-error_log

    CustomLoglogs/www.example.com-access_log common

</VirtualHost>

    ServerAdminwebmaster@dummy-host.example.com

    DocumentRoot/var/www/html/bbs/

    ServerNamebbs.example.com

    ErrorLoglogs/bbs.example.com-error_log

    CustomLoglogs/bbs.example.com-access_log common

测试:

[root@xuegod60 conf]# service httpd restart

http://192.168.10.60/

如何进行源码编译搭建LAMP环境

http://192.168.10.60:90

如何进行源码编译搭建LAMP环境

关于如何进行源码编译搭建LAMP环境就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


网站题目:如何进行源码编译搭建LAMP环境
本文路径:http://cdkjz.cn/article/gccghi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220