duanmei1885 2015-03-11 05:15
浏览 45

如何部署laravel宅基地环境

I have built an API using laravel and laravel homestead. I am now looking for the easiest way to host it online, so that I can consume the API with a mobile app I'm working on.

I tried simply deploying the repo to heroku, but that just gives me errors. It always works great for rails, but for laravel I get failures and this is all that's in my logs:

2015-03-10T01:56:53.074222+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/api/v1/users?token=1234" host=selfiesnap-api.herokuapp.com request_id=07dbc670-2775-45a6-995f-900e51c0854b fwd="68.56.144.126" dyno= connect= service= status=503 bytes=

Since everything is already in a contained, vagrant environment (homestead), I was hoping there would be a more straightforward way to launch the API into a hosted environment.

  • 写回答

1条回答 默认 最新

  • dsn5510 2015-05-20 03:50
    关注

    Install laravel homestead on a Windows computer is not that difficult. Just follow the Laravel documentation and add one environment variable. I will also try to explain the steps.

    Follow these steps:

    1 - First, you need install VirtualBox & Vagrant (please refer laravel docs )

    2 - Add box by typing "vagrant box add laravel/homestead" (If this command fails, you may have an old version of Vagrant that requires the full URL: "vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead"

    3 - clone homestead by typing: "git clone https://github.com/laravel/homestead.git Homestead"

    4 - Add this path to your environment variables. "C:\Users\YourUserName\AppData\Roaming\Composer\vendor\bin"

    5 - Run "bash init.sh" to generate homestead.yaml file inside your .homestead directory.

    6 - Generate ssk key if you haven't already by typing: ssh-keygen -t rsa -C "you@emailaddress.com"

    7 - Initialize homestead by typing "homestead init"

    8 - Run homestead by typing "homestead up"

    Don't forget to add the "domains" for your Nginx sites to the hosts file on your machine! The hosts file will redirect your requests for the local domains into your Homestead environment. On Windows, it is located at C:\Windows\System32\drivers\etc\hosts. The lines you add to this file will look like the following:

    192.168.10.10 homestead.app (if 192.168.1.1 is not working, try 127.0.0.1)

    That's all. Good luck

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!