LAMP环境安装

本文详细介绍如何在Linux环境下解决FTP访问问题、安装GCC及相关依赖、Zlib压缩库及Apache服务器,并配置虚拟主机,确保多站点正常运行。

 

1. 访问ftp报错

 

解决方法:

 

关闭selinux

 

vi  /etc/selinux/config

 

内容修改为:   selinux=disable

 

之后输入reboot重启。

2.依赖软件查询

http://rpmfind.net

 

一.安装gcc

gcc

cloog-ppl

ppl(libppl.so.7/libppl_c.so.2)

cpp

mpfr(libmpfr.so.1)

gcc-c++

libstdc++-devel

mpfr-2.4.1-6.el6.i686.rpmppl-0.10.2-11.el6.i686.rpm

 

二.安装zlib压缩库

 

shell>## cd /home/jinnan/tar

shell># tar –zxvf zlib-1.2.5.tar.gz

shell># cd zlib-1.2.5

shell># ./configure  //这个配置编译命令不要加目录参数

shell># make && make install

 

三.安装apache

 

shell># cd /home/jinnan/tar

shell># tar -jxvf httpd-2.2.19.tar.bz2

shell># cd httpd-2.2.19

 shell>#./configure --prefix=/usr/local/http2  \

--enable-modules=all \

--enable-mods-shared=all \

--enable-so

shell># make && make install

 

启动Apache

shell># /usr/local/http2/bin/apachectl start/stop/restart

 

#测试apache

浏览器打开: http://虚拟机IP

看到 "it works!",即为成功

 

配置虚拟主机

1)配置host文件

打开C:/windows/system32/drivers/etc/hosts 文件

增加域名记录

如:

192.168.9.38 www.ec1.com

192.168.9.38 www.ec2.com

2) 增加虚拟主机

vi /usr/local/http2/conf/httpd.conf

取消#  Include conf/extra/httpd-vhosts.conf

这一行前面的#

保存退出

 

vi /usr/local/http2/conf/extra/httpd-vhosts.conf

增加虚拟主机记录

 

<VirtualHost *:80>

     ServerAdmin webmaster@dummy-host.example.com

     DocumentRoot "/usr/local/http2/htdocs/ec1"

     ServerName www.ec1.com

     ServerAlias www.dummy-host.example.com

     ErrorLog "logs/dummy-host.example.com-error_log"

     CustomLog "logs/dummy-host.example.com-access_log" common

</VirtualHost>

<VirtualHost *:80>

     ServerAdmin webmaster@dummy-host2.example.com

    DocumentRoot "/usr/local/http2/htdocs/ec2"

     ServerName www.ec2.com

     ErrorLog "logs/dummy-host2.example.com-error_log"

     CustomLog "logs/dummy-host2.example.com-access_log" common

</VirtualHost>

<VirtualHost *:80>

    DocumentRoot "/var/www/shop"

     ServerName www.ec1.com

</VirtualHost>

注意:/var/www/shop  以上三个目录var  www  shop 的其他用户必须有x可执行权限

 

 

3)

   shell># cd /usr/local/http2/htdocs

  shell># mkdir ec1 ec2

   shell># echo this is ec1.com > ec1/index.html

   shell># echo this is ec2.com > ec2/index.html

 

4)重启apache

/usr/local/http2/bin/apachectl restart

 

 

5)浏览器打开www.ec1.com,www.ec2.com

看到不同的网站内容,虚拟主机创建完毕

转载于:https://www.cnblogs.com/fc731655131/p/7904692.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值