By rudolfbruder
Hello,
I would like to host my nuxt app which has a Laravel backend on my VPS. I have done it and it works but when I have my .conf file for domain setup like this:
<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>
The nuxt app works and server-side rendering is enabled but none of my api calls on my domain work.
That could be solved by api subdomain but how can I access my laravel files stored in /storage?
I have run php artisan storage:link but I cannot get the files to show because the nuxt server is I believe kill request to the laravel part.
Can anybody help, please?
Thank you.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
Indeed one option is to setup the Laravel application on a subdomain name for example: api.your_domain.com.
That way the two applications will be separate and would have separate Apache virtual hosts.
Another option is to setup an alias for your Laravel application inside the Apache Vhost that you shared:
Alias /app /var/www/laravel/public
That way your Laravel appliation would be accessible at yourdomain.com/app.
Note that you will also need to change your Laravel APP_URL to APP_URL=http://yourdomain.com/app and if you have an .htaccess file you will need to change the following:
// ...
RewriteEngine On
# Add this line
RewriteBase /app/
// ...
Hope that this helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.