作業系統:微軟視窗10
后端框架:Laravel
我的目標:當我訪問“http://example.domain”時,它可以直接訪問laravel index.php。
httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs\NKUST_foodpanda\public"
DirectoryIndex index.php
ServerName example.domain
ErrorLog "C:\Apache24\logs\error.log"
CustomLog "C:\Apache24\logs\access.log" combined
<Directory "C:\Apache24\htdocs\NKUST_foodpanda\public">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
我保存 httpd-vhosts.conf 并重新啟動我的 apache,現在,當我訪問“http://example.domain”時,它將指向“C:\Apache24\htdocs”,而不是“C:\Apache24\htdocs” \NKUST_foodpanda\public”。
uj5u.com熱心網友回復:
我已經嘗試過使用以下條目 httpd-vhost.conf 使用與您相同的可能場景。用''和'/'檢查它,它對我有用。確保為您的目錄提供適當的權限。如果這不起作用,您需要提供更多資訊。
<VirtualHost example.domain:80>
DocumentRoot "C:\Apache24\htdocs\NKUST_foodpanda\public"
DirectoryIndex index.html
ServerName example.domain
ErrorLog "C:\Apache24\logs\error.log"
CustomLog "C:\Apache24\logs\access.log" combined
<Directory "C:\Apache24\htdocs\NKUST_foodpanda\public">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
uj5u.com熱心網友回復:
如果要在“httpd-vhosts.conf”中設定較新的設定,則必須洗掉“httpd.conf”中的“Include conf/extra/httpd-vhosts.conf”注釋。
我沒有注意到這個問題,我注釋掉了“Include conf/extra/httpd-vhosts.conf”并同時在“httpd-vhosts.conf”中設定了一些東西,所以“httpd-vhosts.conf”不起作用.
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/324608.html
上一篇:PerlApache腳本按預期從browser-perfroms運行會關閉正在運行的perl實體,但是在嘗試啟動新的perl實體時,它什么也不做
下一篇:如何使用混合分隔符(即方括號、空格和雙引號)來決議日志(nginx/apacheaccess.log)?并可選擇轉換為json
