1、nginx 下部署出现404错误
(1)打开php.ini中的php_openssl.dll这个扩展;
(2)修改nginx 下的站点目录配置文件(我的是配置在vhost.conf)为:
location / { index index.html index.htm index.php l.php,server.php; #这个保留,要不然会出现laravel 首页403 错误 autoindex off;#这个保留 try_files $uri $uri/ /index.php?$query_string; }
(3)保存并重启nginx
2、apache下部署出现404错误
(1),php开启phpopenssl
(2),在apache conf开启rewrite莫块
模块(#LoadModule rewrite_module modules/mod_rewrite.so)
(3),在conf文件中找到directory 把AllowOverride None 改成 AllowOverride All
<Directory>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
(4),在laravel项目工程的public目录下添加.htaccess文件 ,文件内容如下
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
(5)、restart以下Apache服务器就没问题了。