我在apache服务器上尝试了laravel项目。
我克隆了我的项目
sudo -u www-data git clone ******* laravel午餐作曲家
sudo -u www-data composer install --no-dev --optimize-autoloader午餐npm与webpack
sudo -u www-data npm install
sudo -u www-data npm run production创建.env
sudo -u www-data cp .env.example .env生成键
sudo -u www-data php artisan key:generate
sudo -u www-data php artisan config:cache在克隆我的项目并安装了所有包之后,我配置了.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /laravel/
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>和000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Alias /laravel /var/www/html/laravel/public/
<Directory "/var/www/html/laravel/public">
AllowOverride All
allow from all
Options +Indexes
</Directory>但是当我尝试登录时,我有一个500错误。


有人对此有解释吗?
更新1
我忘了这么做:
sudo -u www-data php artisan passport:install但是现在我所有的web路由都有这个错误。

更新2
我所有的网络线路都有127.0.0.1:8000。但我在制作,我不应该有这个,不是吗?
更新3
我安装了水果蛋糕/拉拉
sudo composer remove barryvdh/laravel-cors fruitcake/laravel-cors
sudo -u www-data composer require fruitcake/laravel-cors我允许CORS在app/Http/Kernel.php中使用您的所有路由。
protected $middleware = [
\Fruitcake\Cors\HandleCors::class,
// ...
]我重新加载了我的Laravel配置并允许我的更改反映
sudo -u www-data php artisan config:cache对于mapApiRoutes来说,这是工作,而不是mapWebRoutes。如何修复mapWebRoutes?
发布于 2020-10-14 14:04:06
我太蠢了..。
在我的份上,我有这个
created() {
axios.get('http://127.0.0.1:8000/tasksList')
.then(response => this.tasks = response.data)
.catch(error => console.log(error));
},但是,在我的.env里
APP_URL=http://*****.*****.***:8080我修正了我的成分
created() {
axios.get('/tasksList')
.then(response => this.tasks = response.data)
.catch(error => console.log(error));
},现在是工作了。
发布于 2020-10-09 11:01:04
发布于 2020-10-09 13:21:05
我猜不需要允许和要求,但我在所有的项目中都使用了类似的配置,而且它正在工作
AllowOverride所有订单允许,拒绝
人人都允许
要求所有的批准
https://stackoverflow.com/questions/64278364
复制相似问题