You should be able to just set the path to wherever your index.php file is located using the above.
php artisan serve should then use this directory to serve your application.
For example, if my directory is public_html:
app/Providers/AppServiceProvider.php
public function register()
{
$this->app->bind('path.public', function() {
return base_path('public_html');
});
}
I think you will also want to update server.php in this case:
server.php
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public_html'.$uri)) {
return false;
}
require_once __DIR__.'/public_html/index.php';
After the changes, re-run php artisan serve