windows:
修改 hosts文件位于
C:\WINDOWS\system32\drivers\etc\
修改如下
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 www.xxx.com
修改apache配置文件:
apache\Apache2.2.21\conf\extra httpd-vhosts.conf
修改如下 目录(/index.php入口文件所在)和域名
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "c:/Apache2/docs/dummy-host.example.com"
ServerName dummy-host.example.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 "F:/www"
ServerName localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "F:/www/app"
ServerName www.xxx.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
还需要修改\Apache2.2.21\conf下 httpd.conf
#Include conf/extra/httpd-vhosts.conf
把这句前面的#去掉
Include conf/extra/httpd-vhosts.con
使用YAF还需要 开启重写
LoadModule rewrite_module modules/mod_rewrite.so
YAF下载windows选择编译好的对应版本下载(版本不对也无法启动apache)
http://code.google.com/p/yafphp/downloads/list?can=1&q=
下载完成放入php\ext下改个短点名字 php_yaf.dll
修改 php.ini
添加下面这句
extension=php_yaf.dll
phpinfo();搜下页面有yaf就可以了,其它配置参考yaf框架手册吧
linux:ubuntu10.04
第一步:
创建/etc/apache2/sites-available/www
<VirtualHost *:80>
DocumentRoot /home/www/
<Directory "/home/www/">
Options Indexes MultiViews FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
Allow from all
</Directory>
#RewriteEngine on
ServerName www.www.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
第二步:
#ubuntu很多不知道这里sites-enabled文件都是 sites-available下的ln -s 文件
cd /etc/apache2/sites-enabled/www
sudo ln -s /etc/apache2/sites-available/www
重启 sudo service apache2 restart
第三步:
sudo vi /etc/hosts
修改内容
127.0.0.1 localhost
127.0.1.1 lei-Lenovo
127.0.0.1 www.www.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
重启网络
sudo /etc/init.d/networking restart
通常会出现 没有权限 问题:
ps -aux|grep apache2
ps参数 -
A
:所有的 process 均显示出来,与 -e 具有同样的效用;
-a :不与 terminal 有关的所有 process ;
-u :有效使用者 (effective user) 相关的 process ;
x :通常与 a 这个参数一起使用,可列出较完整信息。
结果: TTY 登入者的终端机位置啰;
VSZ
:该 process 使用掉的虚拟内存量 (Kbytes)
RSS
:该 process 占用的固定的内存量 (Kbytes)
STAT
:该程序目前的状态,主要的状态有:
o
R
:该程序目前正在运作,或者是可被运作;
o
S
:该程序目前正在睡眠当中 (可说是 idle 状态啦!),但可被某些讯号 (signal) 唤醒。
o
T
:该程序目前正在侦测或者是停止了;
o
Z
:该程序应该已经终止,但是其父程序却无法正常的终止他,造成 zombie (疆尸) 程序的状态
vim application.ini
vim /etc/apache2/apache2.conf 修改用户名和用户组!
vim .htaccess htaccess文件是Apache服务器中的一个配置文件,它负责相关目录下的网页配置。
cp .htaccess .htaccess.ini
rm -rf .htaccess
mysql -uroot -p123456 用户名root,密码123456登录mysql数据库。