Larave&Nuxt托管在VPS相同的域上,如何访问laravel存储和API?

时间:2020-10-12 18:56:00

标签: laravel apache2 nuxt.js vps

我想托管我的nuxt应用,该应用在我的vps上具有laravel后端。我已经做到了,并且可以正常工作,但是当我拥有用于​​域设置的.conf文件时,如下所示:

    <IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName xxxxxxxxx
Redirect permanent / https://xxxxxxxxx/
</VirtualHost>
<VirtualHost *:443>
    ServerName xxxxxxxxx
        ServerAlias www.xxxxxxxxx
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/htmlxxxxxxxxx/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    # has Nuxt runs on port 3000
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
    RewriteEngine on
<Directory /var/www/html/xxxxxxxxx/public/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/livexxxxxxxxx-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xxxxxxxxx-0001/privkey.pem
</VirtualHost>
</IfModule>

nuxt应用程序正常运行,并且启用了服务器端渲染,但是我的域上的所有api调用均不起作用。可以通过api子域解决,但是如何访问存储在/ storage中的laravel文件?我已经运行了php artisan storage:link,但是我无法显示文件,因为我相信nuxt服务器是对laravel部分的终止请求。

有人可以帮忙吗?

谢谢。

0 个答案:

没有答案