一直在搜索關於在我的Linux mint 18.2系統上運行apache 2.4的配置laravel 5.4的最近3天之外,什麼都無法訪問。當apache服務器啓動時,我手動在瀏覽器中輸入localhost,它確實顯示了laravel的默認主頁,但是當我嘗試通過實時預覽在括號中進行訪問時(實時預覽基本URL:http://localhost作爲我的laravel項目專業人員的謊言在/ var/www/html /中),但它會引發與我的apache配置中的錯誤相對應的內部服務器錯誤。因此,我在apache2和apache2的啓用站點的目錄中提出了我的.htaccess文件000-default.conf文件。 conf文件: 一件重要的事情:手之前,我有在/ var/WWW我的項目文件夾PRO/HTML/我的Laravel項目除了主頁
1. 000-default.conf(sites-enabled)
<VirtualHost *:80>
ServerName localhost
ServerAdmin [email protected]
DocumentRoot /var/www/html/pro/public
<Directory /var/www/html/pro/public>
Options Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
2. apache2.conf
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
Include /etc/phpmyadmin/apache.conf
3 .htaccess (/var/www/html/pro/public/.htaccess)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /var/www/html/pro/public/
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
謝謝!
您是否通過本cmd :: php artisan serve爲您服務laravel項目? –
@GauravGupta是的,我發佈這個問題本身之前做到了!這是唯一的原因,我可以看到我的主頁運行,沒有別的 – acaman