ref:
https://www.cnblogs.com/mcray/p/6878846.html
我的处理:
1、apache2下的vhost配置如下:
<VirtualHost *:80>
ServerAdmin ****@126.com
php_admin_value open_basedir /home1/www/xxx.com.cn:/tmp:/var/tmp:/proc
ServerName xxx.com.cn
ServerAlias xxx.com.cn
DocumentRoot /home1/www/xxx.com.cn/public
<Directory /home1/www/xxx.com.cn/public>
SetOutputFilter DEFLATE
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,Allow
Require all granted
#对指定域名开放
Header set Access-Control-Allow-Origin "*"
DirectoryIndex index.php index.html index.htm
</Directory>
ErrorLog /home1/data/wwwlog/xxx.com.cn/error.log
CustomLog /home1/data/wwwlog/xxx.com.cn/access.log combined
</VirtualHost>
2、在laravel项目工程的public目录下的.htaccess文件采用安装时的默认文件。
3、开启rewrite:
sudo a2enmod rewrite
4、重启apache:
sudo service apache2 restart
完成!