os x MAMP apache virtual host laravel 项目配置错误
os x MAMP apache virtual host laravel project misconfigured
MAMP 安装在 MacBook 中。我使用 MAMP 阿帕奇。
根据网上的很多资源,我做了以下工作:
我将 127.0.0.1 my-site.local
添加到文件 /etc/host
。
我在 /Applications/MAMP/conf/apache/httpd.conf
中取消注释 Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
。
在/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
中,我添加了
<VirtualHost *:80>
DocumentRoot "/Users/myname/laravel/mysite/public"
ServerName my-site.local
ServerAlias my-site.local
<Directory "/Users/myname/laravel/mysite/public">
DirectoryIndex index.php
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
在 /Users/myname/laravel/mysite/.htaccess
文件中:
<IfModule mod_rewrite.c>
Options +Indexes +FollowSymLinks +MultiViews
RewriteEngine On
#RewriteBase /
# Redirect Trailing Slashes If Not A Folder...
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/$ / [L,R=301]
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Require all granted
</IfModule>
毕竟,localhost
、localhost/MAMP
、localhost/phpMyAdmin
,所有工作,除了 my-site.local
。
它显示 500 Internal server error. The server encountered an internal error or misconfiguration and was unable to complete your request.
问题解决了!
因为apache已经更新到apache2.2,
在 Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 中,
将 Require all granted
更改为 Satisfy Any
。
就是这样!
我弄了两天才搞定~
MAMP 安装在 MacBook 中。我使用 MAMP 阿帕奇。
根据网上的很多资源,我做了以下工作:
我将
127.0.0.1 my-site.local
添加到文件/etc/host
。我在
/Applications/MAMP/conf/apache/httpd.conf
中取消注释Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
。在
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
中,我添加了<VirtualHost *:80> DocumentRoot "/Users/myname/laravel/mysite/public" ServerName my-site.local ServerAlias my-site.local <Directory "/Users/myname/laravel/mysite/public"> DirectoryIndex index.php Options +Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> </VirtualHost>
在
/Users/myname/laravel/mysite/.htaccess
文件中:<IfModule mod_rewrite.c> Options +Indexes +FollowSymLinks +MultiViews RewriteEngine On #RewriteBase / # Redirect Trailing Slashes If Not A Folder... #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^(.*)/$ / [L,R=301] RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] Require all granted </IfModule>
毕竟,localhost
、localhost/MAMP
、localhost/phpMyAdmin
,所有工作,除了 my-site.local
。
它显示 500 Internal server error. The server encountered an internal error or misconfiguration and was unable to complete your request.
问题解决了!
因为apache已经更新到apache2.2,
在 Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 中,
将 Require all granted
更改为 Satisfy Any
。
就是这样!
我弄了两天才搞定~