centos 安装apache,
yum install httpd
将httpd.conf中的ServerName 前面的 # 去掉。
apache 2.2 的虚拟机的配置放置在conf/extra/httpd-vhosts.conf 中
apache 虚拟主机设置
a2enmod
rewrite
sudo vim 000-default
修改
ServerName *:80
<VirtualHost *:80>
DocumentRoot /media/data/workspace/phpapp
<Directory /media/data/workspace/phpapp/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
加入
<Directory "/media/program/workspace/neusoft/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
sudo vim localxk
<VirtualHost *:80>
DocumentRoot /media/data/workspace/neusoft/xikang_web
ServerName localxk
</VirtualHost>
/etc/apache2/sites-enabled$ sudo vim localxknew
<VirtualHost *:80>
DocumentRoot /media/data/workspace/neusoft/xikang_new/xikang_new/
ServerName localxknew
</VirtualHost>
sudo vim /etc/apache2/sites-enabled/khn3apps
<VirtualHost *:80>
DocumentRoot /media/data/workspace/khn3apps
ServerName khn3apps
<Directory "/media/program/workspace/khn3apps/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
sudo vim /etc/apache2/sites-enabled/www.number1g.com
<VirtualHost *:80>
DocumentRoot /media/data/workspace/phpapp/number1g.com_wp
ServerName www.number1g.com
<Directory "/media/program/workspace/khn3apps/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
ubuntu+apache2.4+php+phpcms
安装php环境:
sudo apt-get install apache2 php5 mysql-server php5-common php5-mysql php5-curl php5-gd php5-cli php5-ldap php5-mhash libtool libmcrypt-dev php5-mcrypt php5-ldap php-soap php5-sqlite php5-xsl
配置虚拟主机
/etc/apache2/sites-enabled/000-default.conf 中加入
ServerName 127.0.0.1:80
<VirtualHost *:80>
#ServerName www.example.com
ServerName localhost:80
加入:
/etc/apache2/sites-enabled/phpcms.conf
<VirtualHost *:80>
ServerName phpcms_ubuntu.com:80
DocumentRoot /home/tboqi/phpcms
ErrorLog ${APACHE_LOG_DIR}/phpcms-error.log
CustomLog ${APACHE_LOG_DIR}/phpcms-access.log combined
<Directory /home/tboqi/phpcms/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
由于使用我当前的登录用户运行php
需要修改: /etc/apache2/envvars
export APACHE_RUN_USER=
export APACHE_RUN_GROUP=
启动rewrite模块
a2enmod
rewrite