虚拟站点配置
一:
Apache\conf\extra\httpd-vhost.conf 虚拟目录配置文件
添加两个站点
<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "C:/www/w1"
ServerName w1.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-host.example.com
DocumentRoot "C:/www/w2"
ServerName w2.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>
二:
修改Apache\conf\httpd.conf,包含httpd扩展
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
三:
修改http.conf,允许其它ip访问
四:
windows下修改
C:\WINDOWS\system32\drivers\etc\hosts
增加
linux下
vi /etc/hosts
-----------------------------------linux下---------------------
在ubuntu server搭建LAMP环境
----------------------------安装--------------------------------
su、sudo获取root权限
sudo apt-get update 更新软件园本地列表
apt-get安装的软件,默认配置文件都在/etc下
/etc/apache2 /etc/mysql /etc/php5
sudo apt-get install apache2
apache2 -v
sudo apt-get install php5
php5 -v
查看apache是否加载php模块
cat /etc/apache2/mods-enabled/php5.load
sudo apt-get install mysql-server
查看mysql.so是否加载,php在安装过程中并不默认加载mysql.so扩展,需要手动安装
cat /etc/php5/conf.d/mysql.ini
手动安装mysql扩展
sudo apt-get install php5-mysql
一步到位
二:
sudo ap-get install apache2 php5 mysql-server php5-mysql
三:
sudo tasksel install lamp-server
---------------------------扩展--------------------------------------
php添加常用扩展
sudo apt-get install php5-gd curl libcurl3 libcurl3-dev php5-curl
----------------------------虚拟主机---------------------------------
vi /etc/hosts
主机ip test1.com
主机ip test2.com
主机ip test3.com
二级域名全部解析到了 主机ip
sudo mkdir -p /var/wwwroot/{test1,test2,test3}
在apache中配置虚拟主机
cat /etc/apache2/sites-available/default
cp default test1
增加:ServerName test1.com
修改DocumentRoot /wwwroot/test1
修改<Directory /wwwroot/test1/>
启用配置文件,建立软ln
cd ../sites-enanled/
sudo ln -s ../sites-available/test1 test1
重启apache2
vi /etc/mysql/my.cnf
#bind-address = 127.0.0.1
在phpmyadmin中修改