我記得以前php上課時,老師教的時候是使用dreamwaver,而且他是在c碟根目錄設一個資
料夾,而不是設在C:\AppServ\www,日前重新溫習時,忘了怎麼設定,請問要如何設定?
我在想,你該不會不止一個專案目錄。
然後你想說跑不同的專案時能將localhost去對應不同的目錄?
基本上這樣搞雖然沒有說不行,但換個專案就要改一次對應目錄絕對不是可行的方法。
我給你的建議最好就是使用virtualhost來處理。
去找到你的httpd.conf這隻檔案
然後改成如下(加在檔案最後面,其實還有一種是另外建立vhosts.conf,不過除非你熟整個設定
基本上還是先用加在檔尾的方式加如下的內容):
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\Appserv\www
</VirtualHost>
<VirtualHost *:80>
ServerName project1.localhost
DocumentRoot C:\Appserv\www\project1
</Virtualhost>
為什麼原本的也要設?因為原本的你不設會因為vhost導掉的關係可能找不到目錄。
然後下面的就是我建議你切專案的作法。
用project1.localhost(project1你可以自己用自己喜歡的名稱代替)
來對應你想對應的專案的目錄,這邊要注意的事,用這個方法的話,DocumentRoot就可以
設置任何你想放置檔案的目錄位置,而不限於C:\Appserv\www底下
(改完之後要記得重啟apache,建議改之前務必先備份檔案)
不過如果你光是改這隻是沒用的。因為你的瀏覽器根本就找不到你設定的位置。
你要去C:\windows\system32\drivers\etc\下找到hosts這隻檔案(對!沒副檔名)
然後要用管理員權限去開這隻檔案(因為預設是唯讀)
進去後加上這行:
127.0.0.1 project1.localhost
加上去存檔之後就行了,不用做任何重開的動作。
會覺得太複雜???就耐心一動一動做做看吧。
想請教 Samと可樂快跑大師,您的方法我試了還是不行...
你所謂的不行,是你做了那些事然後不行?
基本上照設定改不行,一個是你改完httpd.conf後你沒有重啟apache
。另一個是你改完hosts之後,你在網址第一次沒有加上http://
。(第一次有加的話,第二次應該瀏覽器自己就分辯得出來了。)
再來,我提到的project1只是「範例」。
你應該不會整個就照抄吧?
如果在瀏覽器列輸入http://localhost/chap4.php
會出現下列訊息....
Not Found
The requested URL /chap4.php was not found on this server.
我沒有整個抄,雖然我弱...., 麻煩大師解惑,謝謝!!
你不把你目前寫的設定檔貼上來,我也不知道你寫成什麼狀況啊!
記著:發問時,貼上你編輯的內容結果很重要,除非有帳號密碼,請自行屏蔽掉!
不好意思,我發現是C:\windows\system32\drivers\etc\hosts無法修改,可是我點那個檔按滑鼠右鍵,找不到管理員權限....我的電腦是win10,晚點我上網查查怎麼改,先謝謝您了。
用管理員權限開記事本,再去開那個檔案應該就可以。
可是改完後,不管我資料是放在C:\AppServ\www\appproject1或是C:\appproject1,在瀏覽器列打入http://localhost/chap4.php
皆會出現
Not Found
The requested URL /chap4.php was not found on this server.
又要麻煩您了,TKS。
C:\AppServ\Apache24\conf\httpd.conf的內容如下....
Define SRVROOT "C:/AppServ/Apache24"
ServerRoot "${SRVROOT}"
#Listen 12.34.56.78:80
Listen 80
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule data_module modules/mod_data.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule dumpio_module modules/mod_dumpio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule http2_module modules/mod_http2.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule lua_module modules/mod_lua.so
#LoadModule macro_module modules/mod_macro.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_html_module modules/mod_proxy_html.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule request_module modules/mod_request.so
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_crypto_module modules/mod_session_crypto.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule speling_module modules/mod_speling.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule php5_module C:/AppServ/php5/php5apache2_4.dll
PHPIniDir "C:/AppServ/php5/"
ServerAdmin admin@example.com
ServerName localhost:80
DocumentRoot "C:/AppServ/www"
<Directory "C:/AppServ/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
<Files ".ht*">
Require all denied
ErrorLog "logs/error.log"
LogLevel warn
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access.log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access.log" combined
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"
<Directory "${SRVROOT}/cgi-bin">
AllowOverride None
Options None
Require all granted
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi .pl
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
#MIMEMagicFile conf/magic
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#MaxRanges unlimited
#EnableMMAP off
#EnableSendfile on
#AcceptFilter http none
#AcceptFilter https none
#Include conf/extra/httpd-mpm.conf
#Include conf/extra/httpd-multilang-errordoc.conf
Include conf/extra/httpd-autoindex.conf
#Include conf/extra/httpd-languages.conf
#Include conf/extra/httpd-userdir.conf
Include conf/extra/httpd-info.conf
#Include conf/extra/httpd-manual.conf
#Include conf/extra/httpd-dav.conf
#Include conf/extra/httpd-default.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\Appserv\www
<VirtualHost *:80>
ServerName Appproject1.localhost
DocumentRoot C:\Appproject1
C:\Windows\System32\drivers\etc\hosts的內容如下....
127.0.0.1 3dns-2.adobe.com #192.150.22.22
127.0.0.1 3dns-3.adobe.com #192.150.14.21
127.0.0.1 3dns-4.adobe.com #192.150.18.247
127.0.0.1 3dns-5.adobe.com #192.150.22.46
127.0.0.1 adobe-dns.adobe.com #192.150.11.30
127.0.0.1 adobe-dns-2.adobe.com #192.150.11.247
127.0.0.1 adobe-dns-3.adobe.com #192.150.22.30
127.0.0.1 adobe.activate.com #69.175.22.26
127.0.0.1 activate.adobe.com #192.150.22.40
127.0.0.1 activate.wip3.adobe.com #192.150.22.40
127.0.0.1 activate.wip4.adobe.com #192.150.22.40
127.0.0.1 activate-sea.adobe.com #192.150.22.40
127.0.0.1 activate-sjc0.adobe.com #192.150.14.69
127.0.0.1 ereg.adobe.com #192.150.18.103
127.0.0.1 ereg.wip3.adobe.com #192.150.18.63
127.0.0.1 ereg.wip4.adobe.com #192.150.18.103
127.0.0.1 practivate.adobe.com #192.150.18.54
127.0.0.1 www.wip3.adobe.com #192.150.8.60
127.0.0.1 www.wip4.adobe.com #192.150.18.200
127.0.0.1 www.adobeereg.com #75.125.24.83
127.0.0.1 adobeereg.com #207.66.2.10
127.0.0.1 hl2rcv.adobe.com #192.150.14.174
127.0.0.1 wwis-dubc1-vip30.adobe.com #192.150.8.30
127.0.0.1 wwis-dubc1-vip31.adobe.com #192.150.8.31
127.0.0.1 wwis-dubc1-vip32.adobe.com #192.150.8.32
127.0.0.1 wwis-dubc1-vip33.adobe.com #192.150.8.33
127.0.0.1 wwis-dubc1-vip34.adobe.com #192.150.8.34
127.0.0.1 wwis-dubc1-vip35.adobe.com #192.150.8.35
127.0.0.1 wwis-dubc1-vip36.adobe.com #192.150.8.36
127.0.0.1 wwis-dubc1-vip37.adobe.com #192.150.8.37
127.0.0.1 wwis-dubc1-vip38.adobe.com #192.150.8.38
127.0.0.1 wwis-dubc1-vip39.adobe.com #192.150.8.39
127.0.0.1 wwis-dubc1-vip40.adobe.com #192.150.8.30
127.0.0.1 wwis-dubc1-vip41.adobe.com #192.150.8.41
127.0.0.1 wwis-dubc1-vip42.adobe.com #192.150.8.42
127.0.0.1 wwis-dubc1-vip43.adobe.com #192.150.8.43
127.0.0.1 wwis-dubc1-vip44.adobe.com #192.150.8.44
127.0.0.1 wwis-dubc1-vip45.adobe.com #192.150.8.45
127.0.0.1 wwis-dubc1-vip46.adobe.com #192.150.8.46
127.0.0.1 wwis-dubc1-vip47.adobe.com #192.150.8.47
127.0.0.1 wwis-dubc1-vip48.adobe.com #192.150.8.48
127.0.0.1 wwis-dubc1-vip49.adobe.com #192.150.8.49
127.0.0.1 wwis-dubc1-vip50.adobe.com #192.150.8.50
127.0.0.1 wwis-dubc1-vip51.adobe.com #192.150.8.51
127.0.0.1 wwis-dubc1-vip52.adobe.com #192.150.8.52
127.0.0.1 wwis-dubc1-vip53.adobe.com #192.150.8.53
127.0.0.1 wwis-dubc1-vip54.adobe.com #192.150.8.54
127.0.0.1 wwis-dubc1-vip55.adobe.com #192.150.8.55
127.0.0.1 wwis-dubc1-vip56.adobe.com #192.150.8.56
127.0.0.1 wwis-dubc1-vip57.adobe.com #192.150.8.57
127.0.0.1 wwis-dubc1-vip58.adobe.com #192.150.8.58
127.0.0.1 wwis-dubc1-vip59.adobe.com #192.150.8.59
127.0.0.1 wwis-dubc1-vip60.adobe.com #192.150.8.60
127.0.0.1 wwis-dubc1-vip61.adobe.com #192.150.8.61
127.0.0.1 wwis-dubc1-vip62.adobe.com #192.150.8.62
127.0.0.1 wwis-dubc1-vip63.adobe.com #192.150.8.63
127.0.0.1 wwis-dubc1-vip64.adobe.com #192.150.8.64
127.0.0.1 wwis-dubc1-vip65.adobe.com #192.150.8.65
127.0.0.1 wwis-dubc1-vip66.adobe.com #192.150.8.66
127.0.0.1 wwis-dubc1-vip67.adobe.com #192.150.8.67
127.0.0.1 wwis-dubc1-vip68.adobe.com #192.150.8.68
127.0.0.1 wwis-dubc1-vip69.adobe.com #192.150.8.69
127.0.0.1 wwis-dubc1-vip70.adobe.com #192.150.8.70
127.0.0.1 wwis-dubc1-vip71.adobe.com #192.150.8.71
127.0.0.1 wwis-dubc1-vip72.adobe.com #192.150.8.72
127.0.0.1 wwis-dubc1-vip73.adobe.com #192.150.8.73
127.0.0.1 wwis-dubc1-vip74.adobe.com #192.150.8.74
127.0.0.1 wwis-dubc1-vip75.adobe.com #192.150.8.75
127.0.0.1 wwis-dubc1-vip76.adobe.com #192.150.8.76
127.0.0.1 wwis-dubc1-vip77.adobe.com #192.150.8.77
127.0.0.1 wwis-dubc1-vip78.adobe.com #192.150.8.78
127.0.0.1 wwis-dubc1-vip79.adobe.com #192.150.8.79
127.0.0.1 wwis-dubc1-vip80.adobe.com #192.150.8.80
127.0.0.1 wwis-dubc1-vip81.adobe.com #192.150.8.81
127.0.0.1 wwis-dubc1-vip82.adobe.com #192.150.8.82
127.0.0.1 wwis-dubc1-vip83.adobe.com #192.150.8.83
127.0.0.1 wwis-dubc1-vip84.adobe.com #192.150.8.84
127.0.0.1 wwis-dubc1-vip85.adobe.com #192.150.8.85
127.0.0.1 wwis-dubc1-vip86.adobe.com #192.150.8.86
127.0.0.1 wwis-dubc1-vip87.adobe.com #192.150.8.87
127.0.0.1 wwis-dubc1-vip88.adobe.com #192.150.8.88
127.0.0.1 wwis-dubc1-vip89.adobe.com #192.150.8.89
127.0.0.1 wwis-dubc1-vip90.adobe.com #192.150.8.90
127.0.0.1 wwis-dubc1-vip91.adobe.com #192.150.8.91
127.0.0.1 wwis-dubc1-vip92.adobe.com #192.150.8.92
127.0.0.1 wwis-dubc1-vip93.adobe.com #192.150.8.93
127.0.0.1 wwis-dubc1-vip94.adobe.com #192.150.8.94
127.0.0.1 wwis-dubc1-vip95.adobe.com #192.150.8.95
127.0.0.1 wwis-dubc1-vip96.adobe.com #192.150.8.96
127.0.0.1 wwis-dubc1-vip97.adobe.com #192.150.8.97
127.0.0.1 wwis-dubc1-vip98.adobe.com #192.150.8.98
127.0.0.1 wwis-dubc1-vip99.adobe.com #192.150.8.99
127.0.0.1 wwis-dubc1-vip100.adobe.com #192.150.8.100
127.0.0.1 wwis-dubc1-vip101.adobe.com #192.150.8.101
127.0.0.1 wwis-dubc1-vip102.adobe.com #192.150.8.102
127.0.0.1 wwis-dubc1-vip103.adobe.com #192.150.8.103
127.0.0.1 wwis-dubc1-vip104.adobe.com #192.150.8.104
127.0.0.1 wwis-dubc1-vip105.adobe.com #192.150.8.105
127.0.0.1 wwis-dubc1-vip106.adobe.com #192.150.8.106
127.0.0.1 wwis-dubc1-vip107.adobe.com #192.150.8.107
127.0.0.1 wwis-dubc1-vip108.adobe.com #192.150.8.108
127.0.0.1 wwis-dubc1-vip109.adobe.com #192.150.8.109
127.0.0.1 wwis-dubc1-vip110.adobe.com #192.150.8.110
127.0.0.1 wwis-dubc1-vip111.adobe.com #192.150.8.111
127.0.0.1 wwis-dubc1-vip112.adobe.com #192.150.8.112
127.0.0.1 wwis-dubc1-vip113.adobe.com #192.150.8.113
127.0.0.1 wwis-dubc1-vip114.adobe.com #192.150.8.114
127.0.0.1 wwis-dubc1-vip115.adobe.com #192.150.8.115
127.0.0.1 wwis-dubc1-vip116.adobe.com #192.150.8.116
127.0.0.1 wwis-dubc1-vip117.adobe.com #192.150.8.117
127.0.0.1 wwis-dubc1-vip118.adobe.com #192.150.8.118
127.0.0.1 wwis-dubc1-vip119.adobe.com #192.150.8.119
127.0.0.1 wwis-dubc1-vip120.adobe.com #192.150.8.120
127.0.0.1 wwis-dubc1-vip121.adobe.com #192.150.8.121
127.0.0.1 wwis-dubc1-vip122.adobe.com #192.150.8.122
127.0.0.1 wwis-dubc1-vip123.adobe.com #192.150.8.123
127.0.0.1 wwis-dubc1-vip124.adobe.com #192.150.8.124
127.0.0.1 wwis-dubc1-vip125.adobe.com #192.150.8.125
127.0.0.1 appproject1.localhost
...
我說你貼這一大串……
你只要貼你的hosts跟你加在httpd.conf中的我給你的VirtualHost的範例就可以了。
我主要要看就這二個東西……
希望你待會的回應,是確實給我這二樣東西。
其他的東西不必要的請先不要貼。
好吧!我還真的好不容易才大海撈針撈到…
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\Appserv\www
<VirtualHost *:80>
ServerName Appproject1.localhost
DocumentRoot C:\Appproject1
你這樣改……照理說你應該連AppServ都開不起來吧!
雖然我不確定是你的問題還是站方編輯器過濾的問題
完整應該如下:
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\Appserv\www
</VirtualHost>
<VirtualHost *:80>
ServerName appproject1.localhost
DocumentRoot C:\Appproject1
</VirtualHost>
你確定沒有少掉?
另外改完後你有重開apache嗎?
另外就是我不確定windows的大小寫會不會有分就是了…
建議大小寫也統一一下。
(我沒辦法幫你確認,因為我是用mac os)
記住,改完設定一定要重開apache是基本課題,很多人都常常忘記。
sorry...讓您費眼力了,報告一下,其實我設的跟您上述的一樣,但是後來我發現,如果槓掉第一個設定,
<VirtualHost *:80>
ServerName localhost
DocumentRoot C:\Appserv\www
就可以正常運作,如果加上,就會出現如下
You don't have permission to access / on this server.
上面我有加上,奇怪,貼的時候它會自動不見了....