Articles of laravel

Laravel路线在逆向代理之后

好吧,为了发展的目的,我们有一个专门的networking服务器。 它目前不直接连接到互联网,所以我已经在另一台服务器上设置了一个Apache反向代理,该服务器转发给开发服务器。 这样,我可以通过Web访问服务器。 问题是,Laravel中的路由现在以内部服务器IP地址或服务器计算机名称为前缀。 例如,我转到http://subdomain.test.com,但是使用route()帮助程序生成的所有路由都显示以下url: http://subdomain.test.com而不是http://subdomain.test.com 。 反向代理设置如下: <VirtualHost *:80> ServerName igateway.somedomain.com ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://10.47.32.22:80/ ProxyPassReverse / http://10.47.32.22:80/ <Location /> Order allow,deny Allow from all </Location> </VirtualHost> 我已经在config\app.php设置了实际的域名。 题 如何设置路由中使用的默认URL? 我不希望它使用内部地址,因为这会破坏反向代理的要点。 我试图把所有的路线都放在一个Route::group(['domain' …组中,这也不起作用。

如何在Xampp上为Laravel启用虚拟主机?

我有Windows 7 Pro上运行的XAMPP。 我正在尝试设置一个虚拟主机,以便当我使用“dev.app”作为域时,我直接进入laravel安装的公共文件夹。 Laravel位于F:/xampp/htdocs/dev/public 我打开位于F:\xamp\apache\conf\extra\https-vhosts.conf的httpd-vhosts.conf文件 并用这个取代了一切 # Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is […]

我怎样才能修复Laravel 5.1 – 404找不到?

我正在尝试第一次使用Laravel 5.1。 我能够安装它,并https://sub.example.com/laravel/public/显示应该。 然而,我创build的视图给我一个404错误页面找不到。 这是我迄今为止所做的: 我在laravel\app\Http\controllers\Authors.php创build了一个控制器 这是Authors.php文件背后的代码 <?php class Authors_Controller extends Base_Controller { public $restful = true; public function get_index() { return View::make('authors.index') ->with('title', 'Authors and Books') ->with('authors', Author::order_by('name')->get()); } } 然后我在laravel\resources\views\Authors\index.blade.php创build了一个视图 这是index.blade.php文件后面的代码 @layout('layouts.default') @section('content') Hello, this is a test @endsection 然后我在laravel\resources\views\layouts\default.blade.php创build了一个布局 这是default.blade.php文件后面的代码 <!DOCTYPE html> <html> <head> <title>{{ $title }}</title> </head> <body> @if(Session::has('message')) <p style="color: […]

用命令'php artisan serve'运行Laravel有什么意义?

我似乎不明白为什么我们需要运行一个Laravel应用程序与php artisan serve与只运行它与Apache或Nginx 。 我知道在开发中,我们使用工匠来启动网站,并在部署到服务器后,使用networking服务器来加载网站。 在工匠中运行应用程序有什么用处?

Laravel 4虚拟主机和mod重写设置

我已经尝试了几个小时来安装Laravel 4,并使虚拟主机和路由工作,但到目前为止,我一直不走运。 我提到,我正在Windows 7机器和WAMP上做这个。 我会描述我已经做了什么: 我已经启用了rewrite_module。 用以下命令更新了httpd-vhosts.conf: <VirtualHost *:80> DocumentRoot "c:/wamp/www/laravel/public" ServerName laravel.dev ServerAlias www.laravel.dev </VirtualHost> 接下来,我设置了etc/hosts : 127.0.0.1 localhost 127.0.0.1 laravel.dev 另外,在wamp/../conf/httpd.conf和wamp/…/conf/original/httpd.conf ,以下行都是未注释的: LoadModule vhost_alias_module modules/mod_vhost_alias.so Include conf/extra/httpd-vhosts.conf 我的.htaccess的内容如下: <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> 然而,当我去http://laravel.dev我得到一个内部服务器错误 – 服务器遇到内部错误或configuration错误,无法完成您的请求。 。 如果我从公用文件夹中删除.htaccess文件,那么我会看到Laravel“你已经到达”的消息。 如果那么,我创build一个这样的路线(在应用程序\ routes.php内 ): Route::get('/newroute', function() { return View::make('hello'); }); […]

禁止您无权访问此服务器。 Centos 6 / Laravel 4

我完成设置LAMP并安装了我的laravel 4应用程序后,出现问题。 一切似乎顺利,当我去我的IP地址的url,它显示我的应用程序的第一页正确,但所有的页面的其余部分扔我404错误请求的URL在这台服务器上找不到。 所以我添加到我的httpd.conf(在我的项目的虚拟主机下) – AllowOverride All Order allow,deny <VirtualHost *:80> ServerName VPS-IP-ADDRESS DocumentRoot /var/www/html/nextmatch/public_html/public/ <Directory /var/www/html/nextmatch/public_html/public/> AllowOverride all Order allow,deny <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> </VirtualHost> 而现在,当我尝试导航,而不是404错误,我得到了禁止您没有访问此服务器的权限。 我build立了与chmod 775 -R path/laravel/和777的文件夹存储,但仍然有同样的错误任何build议吗? 我不知道这个问题,我越来越疯狂! 感谢您的任何帮助。

Laravel htaccess的问题

我试图设置一个网站的生活。 该网站在我们用来向客户端显示该网站的实时开发服务器上工作得非常好。 这里是活的开发htaccess(工作正常): <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On #RewriteCond %{HTTPS} !=on #RewriteCond %{HTTP_HOST} !^www\..+$ [NC] #RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # Rewrite to 'public' folder RewriteCond %{HTTP_HOST} ^livedev.domain.com$ RewriteCond %{REQUEST_URI} !public/ RewriteRule (.*) public/$1 [L] </IfModule> AuthType Basic AuthName "dev16" AuthUserFile "/home/site/.htpasswds/public_html/passwd" require valid-user 这里是从现场的.htaccess: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On #RewriteCond %{HTTPS} !=on #RewriteCond […]

无法在Laravel路线中访问url

我正在学习Laravel,我正在通过创build一个简单的CRUD(CREATE-READ-UPDATE-DELETE)来完成这个任务。 这是我学习新框架的方式。 在使用CodeIgniter之前,我发现Laravel比CodeIgniter好多了,它有很多function。 我正在学习这个教程 http://www.allshorevirtualstaffing.com/developing-crud-applications-in-laravel-4/ 我正在显示CREATE视图。 但我不能访问它的路线。 这是我的文件夹结构 wamp www mylaravel app bootstrap public vendor 到目前为止,我有这些代码: 调节器 <?php class EmployeesController extends \BaseController { /** * Display a listing of the resource. * * @return Response */ public function index() { $employees = Employee::all(); return View::make('index', compact('employees')); } /** * Show the form for creating a […]

Laravel | 共享托pipe路线工作不正常

我试图在共享主机(godaddy)上部署我的Laravel项目,到目前为止我只部分成功。 我遵循的步骤是: 创build一个子域abc.xyz.com ,root – > public_html/finance/. 将我的laravel项目上传到与public_html相同的文件夹 将我的项目的public目录softlink到public_html/finance/ 我发现去abc.xyz.com没有工作,但abc.xyz.com/public这样做,我设置了一个redirectabc.xyz.comredirect到abc.xyz.com 使Storage访问networking。 dumpautoload ,cachingconfig和routes 。 迁移databases 。 现在我可以成功login,这需要我到abc.xyz.com/public但是我没有/public其他所有路由都不工作。 例如: abc.xyz.com/public – works abc.xyz.com/home – 不起作用 我注意到,如果我手动添加/public所有路线他们的工作! 所以abc.xyz.com/public/home工作。 我的.htaccess: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes If Not A Folder… RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller… […]

Laravel路由不工作,Apacheconfiguration只允许public / index.php /路由

例: Route::get('/get', function() { return 'get'; }); 要查看上面的路线,我必须导航到public / index.php / get。 我已经看过不less东西的post,并尝试不同的东西,并没有什么区别(是的,我重新启动Apache每次)。 这是我的公共目录中的.htaccess: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On </IfModule> # For all files not found in the file system, reroute the request to the # "index.php" front controller, keeping the query string intact <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond […]