[Vuejs]-Laravel with Vuejs run project without php artisan serve

0👍

change the webpack mix file (project_root_path/webpack.mix.js) with the following

mix.js('resources/js/app.js', 'public/js')
 .sass('resources/sass/app.scss', 'public/css')
 .setResourceRoot("/public/");

 mix.webpackConfig({
    output: {
        publicPath: '/public/',
    }
 });

map the project folder into apache config file (/etc/apache2/sites-available/000-default.conf)

VirtualHost *:8000>
    DocumentRoot /var/www/html/ProjectRoot
    Header set Cache-Control max-age=101930

    <Directory /var/www/html/ProjectRoot/public>
        Header set Cache-Control "no-cache"
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

enable the port in (/etc/apache2/ports.conf). add the following line

Listen 8000

restart the apache server and check the url.

1👍

Local Development Server

If you have PHP installed locally and you would like to use PHP’s built-in development server to serve your application, you may use the serve Artisan command.


Deployment

When you’re ready to deploy your Laravel application, you should use a dedicated webserver like Apache or Nginx.

Leave a comment