[英]Laravel Ubuntu server deployment
I have a project in Laravel which I want to deploy it in my new Ubuntu 16.4 server. 我在Laravel中有一个项目,希望将其部署在新的Ubuntu 16.4服务器中。 I have installed all the needed packages and my project is working fine inside the server.
我已经安装了所有必需的软件包,并且我的项目在服务器内部运行正常。
At first it was accessible from --> "IP-Address/project-name/public/index.php" then I made some changes in "/etc/apache2/sites-availabe/000-default.conf" as : 最初,可以从->“ IP-Address / project-name / public / index.php”访问它,然后在“ /etc/apache2/sites-availabe/000-default.conf”中进行如下更改:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/panel/public/
<Directory /var/www/html/panel>"
AllowOverride All
</Directory>
"panel" is the name of my project in Laravel. “面板”是我在Laravel中的项目的名称。 So now I can access my project from " http://IP-Address " but since the project has 2 parts as front and admin panel, i want to access the project in a URL like "IP-Address/" for javascript web part and "IP-address/panel" for the admin panel developed with Laravel.
因此,现在我可以从“ http:// IP-Address ”访问我的项目,但是由于该项目有2个部分作为前面板和管理面板,因此我想以“ IP-Address /”之类的URL来访问该项目,用于javascript Web部件和使用Laravel开发的管理面板的“ IP地址/面板”。
My Apache's configuration file 我的Apache的配置文件
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
<Directory "/var/www/html/public">
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Laravel's project is under /var/www/html
directory. Laravel的项目在
/var/www/html
目录下。
To have another part of your application (for example admin panel under /admin
path) you should use Laravel's router groups. 要拥有应用程序的另一部分(例如,
/admin
路径下的管理面板),您应该使用Laravel的路由器组。 Here you have link to documentation . 在这里,您可以链接到文档 。
Example from documentation 文档中的示例
Route::prefix('admin')->group(function () {
Route::get('users', function () {
// Matches The "/admin/users" URL
});
});
If you want /panel
prefix just change admin
into panel
. 如果要
/panel
前缀,只需将admin
更改为panel
。 All routes for panel declare in this group. 小组的所有路线都在该组中声明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.