我們能不能以某種方式做到這一點。我正在展示示例,但我們可以更改以下代碼。
<Location />
DocumentRoot /var/www/html/app1/public
</Location>
<Location /app2>
DocumentRoot /var/www/html/app2/public
</Location>
uj5u.com熱心網友回復:
我需要什么,例如:192.168.1.23 將打開 app1 和 192.168.1.23/app2 將打開 app1
在這種情況下,您可以使用該Alias指令,如下所示:
<VirtualHost *:80>
DocumentRoot /var/www/html/app1/public
Alias /app2 /var/www/html/app2/public
# add other directives here
</VirtualHost>
這將映射/var/www/html/app2/publicto的檔案系統內容,/app2而默認的 Document Root( /) 將是/var/www/html/app1/public.
我建議您查看此處的檔案,它為您的問題的不同解決方案提供了很好的解釋:https : //httpd.apache.org/docs/2.4/urlmapping.html
uj5u.com熱心網友回復:
不是特定于laravel。如果您希望 Apache 為 2 個不同的應用程式提供檔案,請在 Apache 組態檔中設定虛擬主機
# Ensure that Apache listens on ports
Listen 80
Listen 81
Listen 82
Listen 83
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
<VirtualHost *:81>
DocumentRoot "/www/example3"
# Other directives here
</VirtualHost>
<VirtualHost *:82>
DocumentRoot "/www/example4"
# Other directives here
</VirtualHost>
<VirtualHost *:83>
DocumentRoot "/www/example5"
# in the 'example5' folder place subfolders 'app1' and 'app2'
# navigate in the browser to each app i.e. 127.0.0.1/example5/app1 and 127.0.0.1/example5/app2
# Other directives here
</VirtualHost>
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/364294.html
