Skip to content

Instantly share code, notes, and snippets.

@huzaifa-a
Last active October 24, 2023 04:35
Show Gist options
  • Save huzaifa-a/1fa4163a697fbe4775e315df22d3e32a to your computer and use it in GitHub Desktop.
Save huzaifa-a/1fa4163a697fbe4775e315df22d3e32a to your computer and use it in GitHub Desktop.
Stand alone Laravel mix with Apache2

Configure browserSync

webpack.mix.js

mix.browserSync({
    proxy: 'localhost:8080',
    files: [
        'index.html',
    ]
});
mix.js('src/app.js', 'dist/')
    .sass('src/app.scss', 'dist/')
    .sourceMaps(false, 'inline-source-map');

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="http://localhost:8080/dist/app.css">
    <script src="http://localhost:8080/dist/app.js"></script>
</head>
<body>

</body>
</html>

How To Set Up Apache Virtual Hosts on Ubuntu

sudo gedit /etc/apache2/sites-available/subdomain.conf 
Listen 89

<VirtualHost *:89>
   ServerAdmin admin@localhost
   ServerName  localhost
   DocumentRoot /home/huzaifa/www/mix
	<Directory /home/huzaifa/www/mix/>
		Options Indexes FollowSymLinks
		AllowOverride All
		Require all granted
	</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment