简体   繁体   中英

How to deploy Laravel 5 on a subdomain

I have been using Laravel for quite a while but only recently have the need to deploy an app on a subdomain and I'm having some trouble. Everything works as it should if it's not deployed under a subdomain.

So I have: domain.com (main site) and subdomain.domain.com (app)

When I pull up the subdomain in the browser the index page loads fine(subdomain.domain.com), but when I try to access the login view(subdomain.domain.com/auth/login) - or any other view other than index - I get the following error:

ErrorException in Connector.php line 47: SQLSTATE[HY000] [2002] No such file or directory (View: /var/www/vhosts/domain.com/subdomain/resources/views/app.blade.php) (View: /var/www/vhosts/domain.com/subdomain/resources/views/app.blade.php)

So, it appears Laravel is looking for resources in the wrong directory, but I don't know where to configure the app to look for them in the correct location.

It's on a GoDaddy VPS. I have update config/app.php url to: http://subdomain.domain.com

I setup the subdomain via Plesk and the root points to the public folder under the subdomain.

I have tried wrapping my routes in Route::group(['domain' => 'subdomain.domain.com']....but that didn't help.

Can anyone please point me in the right direction here? Thanks.

I had dismissed the possibility of it being a db issue previously because I knew the credentials were correct and I had deployed in on the top-level for testing and it worked. I just checked my .env file again and everything is correct, but I added port :3306 to localhost and now it's working!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM