<VirtualHost *:80> ServerAdmin admin@localhost ServerName bbs.hehe.com DocumentRoot "d:/wamp/www/babel/htdocs/" <Directory "d:/wamp/www/babel/htdocs"> AllowOverride all Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </Directory> </VirtualHost>大概就这样 改改就行
我做了这样的虚拟端口,但是还是访问不了,是不是还有什么没有配置好啊 NameVirtualHost hankook-gps.com:80<VirtualHost hankook-gps.com:80> ServerAdmin [email protected] DocumentRoot "d:/program files/EasyPHP 3.0/www/web" ServerName hankook-gps.com ServerAlias hankook-gps.com ErrorLog "logs/hankook-gps.comlog" CustomLog "logs/hankook-gps.com" common <Directory "d:/program files/EasyPHP 3.0/www/web"> AllowOverride all Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </Directory> </VirtualHost>
#NameVirtualHost *:80前的注释去掉了吗? 去掉#之后restart加上这里就好了,之后就可加任意多的virtual host了NameVirtualHost 192.168.8.37:80 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. ## # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # #<VirtualHost *:80> # ServerAdmin [email protected] # DocumentRoot /www/docs/dummy-host.example.com # ServerName 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 [email protected] DocumentRoot /var/www/html ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost><VirtualHost 192.168.8.37:80> ServerAdmin [email protected] DocumentRoot /var/www/html ServerName XXX.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost>
ServerAdmin admin@localhost
ServerName bbs.hehe.com
DocumentRoot "d:/wamp/www/babel/htdocs/"
<Directory "d:/wamp/www/babel/htdocs">
AllowOverride all
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>大概就这样 改改就行
NameVirtualHost hankook-gps.com:80<VirtualHost hankook-gps.com:80>
ServerAdmin [email protected]
DocumentRoot "d:/program files/EasyPHP 3.0/www/web"
ServerName hankook-gps.com
ServerAlias hankook-gps.com
ErrorLog "logs/hankook-gps.comlog"
CustomLog "logs/hankook-gps.com" common
<Directory "d:/program files/EasyPHP 3.0/www/web">
AllowOverride all
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
去掉#之后restart加上这里就好了,之后就可加任意多的virtual host了NameVirtualHost 192.168.8.37:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
##
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin [email protected]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName 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 [email protected]
DocumentRoot /var/www/html
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost><VirtualHost 192.168.8.37:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html
ServerName XXX.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
你看下这个
http://foundationphp.com/tutorials/apache22_vhosts.php
ServerAdmin webmaster@localhost DocumentRoot /var/www/WorkSpace/TEST
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/WorkSpace/TEST>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory></VirtualHost>
你看下你路径配置的对吗?放到项目的htdoc目录下
DocumentRoot /var/www/WorkSpace/TEST
<Directory /var/www/WorkSpace/TEST>放到项目的htdocs目录下