0

I am developing a VueJs application in Laravel. In my local environment I have to use php artisan serve command to serve my project. In server I am using php artisan serve --host 0.0.0.0 --port 8000 command to run my project. I have configured apache web server.

Here my question is How should I run the project on the server without using php artisan serve command?. Thanks in advance.

4
  • 4
    using apache or nginx. i guess artisan serve just launches the php inbuilt dev server Commented Jan 28, 2020 at 15:23
  • Laravel has great documentation: laravel.com/docs/6.x Commented Jan 28, 2020 at 15:27
  • php artisan serve should only be used for development purposes. For production you should use a dedicated webserver like apache or nginx. Commented Jan 28, 2020 at 15:34
  • If I have developed entirely in laravel then I could create a virtual host in apache conf file and make it as worked. But I used Vuejs as a frontend and Laravel as a backend. In this scenario How should I configure in apache web server? @Jerodev Commented Jan 28, 2020 at 15:41

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

If I have developed entirely in laravel then I could create a virtual host in apache conf file and make it as worked. But I used Vuejs as a frontend and Laravel as a backend. In this scenario How should I configure in apache web server?
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.