我希望能夠在有兩個不同的文檔根同一個VAR/WWW文件夾和其它一些其他folder.Below是可用網站我的默認文件中的兩個端口上運行的Apache。但是,無論何時我點擊127.0.0.1,第一個虛擬主機中的索引都會顯示出來。 我希望能夠訪問/ home/somefolder/tmp中的索引,如果我點擊127.0.0.1:8080 url,但是我卻得到「瀏覽器無法連接到127.0.0.1:8080」。我錯過了什麼?的Apache2不工作的不同端口
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
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>
<VirtualHost *:8080>
ServerAdmin [email protected]
DocumentRoot /home/somefolder/tmp
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
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>
沒想好+10 –
感謝這個工作我的機器上,但在遠程機器這didnt工作。它給我下面的錯誤的「您沒有權限訪問/在此服務器上。」 – nnm
我在上面的NameVirtualHost上輸入了一個錯字,現在已更正爲8080.您的錯誤聽起來像是缺少默認文檔或您的文檔根目錄不存在。檢查你遇到問題的根目錄的配置。 – arco444