We tried deploying our laravel server by uploading our laravel folder to the linux server. We put the public folder in the public_html/laravelsite and the everything else in the a folder called laravelsite. We added
$this->app->bind('path.public', function() {
return base_path().'/../public_html';
});
to our AppServiceProvider. But when viewing the site in the browser we get the following errors.
app.css:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error) bootstrap.js:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error) app.js:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error) bootstrap.js:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error) app.js:1
Failed to load resource: the server responded with a status of 500 (Internal Server Error) app.css:1
app.css:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error) app.css:1
I commented the code that produces the errors in the landing.blade So we looked at the following post
How can I change the public path to something containing an underscore in Laravel Mix?
But doing that did not work out for us.
landing.blade(landing page)
<!DOCTYPE html>
<!-- hidden override for w3 style this has to be removed before this goes in production !!!!!!!! -->
<html style="overflow:hidden">
<head>
<meta property="og:image" content="/favicon.png" />
<title>Laravel Site</title>
<meta name="description" content="Welcome to out Laravel Site. Come on in!" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{csrf_token()}}">
<!-- This is the first error -->
<link href=" {{ mix('css/app.css') }}" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Raleway:800' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'>
<link href=" {{ asset('css/animate.css') }}" rel="stylesheet">
<link href=" {{ asset('css/text-editor.css') }}" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
<script src="https://d3-geomap.github.io/d3-geomap/vendor/d3.geomap.dependencies.min.js"></script>
<script src="https://d3-geomap.github.io/d3-geomap/js/d3.geomap.min.js"></script>
</head>
<body style="background-color: #f2f2f2;">
<div id="app">
<app></app>
</div>
<!-- This is the second error -->
<script src="{{ mix('js/bootstrap.js') }}"></script>
<!-- This is the third error -->
<script src="{{ mix('js/app.js') }}"></script>
</body>
</html>
webpack.mix
let mix = require("laravel-mix");
mix.setPublicPath("public_html/laravelsite/");
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.webpackConfig({
resolve: {
extensions: [".js", ".vue", ".json"],
alias: {
vue$: "vue/dist/vue.esm.js",
"@": __dirname + "/resources/assets/js"
}
}
});
mix
.js("resources/assets/js/app.js", "public_html/laravelsite/js")
.setResourceRoot("")
.js("resources/assets/js/bootstrap.js", "public_html/laravelsite/js")
.sass("resources/assets/sass/app.scss", "public_html/laravelsite/css");
It is trying to load the files at http://websitename.com/css/app.css , so it's probably looking in the public_html folder. But inside that folder we have another folder called laravelsite so it should be looking for http://websitename.com/laravelsite/css/app.css