How to run laravel in root directory without the public folder?

笑着哭i 提交于 2021-01-20 13:05:10

问题


I am running the latest version of laravel on my own server running Debian and Apache2.

The contents of laravel are located in /var/www which is what my domain name is pointed to however all of the functionality happens through the public directory so I would have to go to http://mydomain.com/public to access anything.

I would like to change it so that I only have to access http://mydomain.com. Is this possible?

How can I change this? Would I have to move everything up another level to the parent at /var?

I haven't found anything online so far that says that it is possible, or that it is a good idea.


回答1:


That is not your problem, you need to point the virtual host to the public folder.




回答2:


The following worked for me, as discussed here: https://stackoverflow.com/a/16569078/3091980

Move all contents of the /public folder down a level. Then update the include lines in index.php to point to the correct location - if it's down a level, remove the "../".




回答3:


Sorry I deleted my old answer .. that was if u rename server.php to index then it will work but of course not because laarvel not load all service. so you have to paste into root all public folder file. and remove "../" from everywhere in index.php



来源:https://stackoverflow.com/questions/20547891/how-to-run-laravel-in-root-directory-without-the-public-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!