Articles of laravel

在Laravel中不允许“Access-Control-Allow-Origin”标头

我怎样才能允许laravel No 'Access-Control-Allow-Origin' header is present on the requested ? 因为当我尝试$http.get()使用angular.js一个特定的URL我总是得到它的错误。

Laravel nginx.conf与官方Heroku PHP的buildpack?

我在我的项目根目录中的`nginx.conf中有以下内容 location / { try_files $uri $uri/ /index.php?$query_string; } 但只有在/path工作,所有其他人都想出了一个404错误。 我怎样才能让Laravel和nginx一起在heroku上工作?

无法加载资源:net :: ERR_INCOMPLETE_CHUNKED_ENCODING

我一直有一些问题,我的应用程序不加载视图(有时)。 我正在用php-fpm和nginx(php5.6.8和nginx 1.8.0)运行Debian服务器,两者都是从源代码编译的。 最重要的是我正在运行Lavavel 4.2。 到目前为止,我已经在Chrome和Firefox的问题(铬只是停止加载,并显示错误,Firefox不显示错误,但显示视图的不完整版本)。 到目前为止,我已经检查了nginx和PHP的权限,它们都以相同的用户身份运行(www-data:www-data)。 我的php-fpm套接字configuration为: [sitename] listen = /var/run/php5-fpm/sitename.sock listen.backlog = -1 listen.owner = www-data listen.group = www-data listen.mode=0660 ; Unix user/group of processes user = folderuser group = www-data ; Choose how the process manager will control the number of child processes. pm = dynamic pm.max_children = 75 pm.start_servers = 10 […]

使用Laravel 5.1远程服务器无法检索URL GET参数

出于某种原因,我无法从使用Illuminate\Http\Request facade的控制器中的url中获取任何GET参数。 我testing了多个控制器,但没有成功。 使用以下代码,在访问domain.com/admin/dashboard?test=test ,远程服务器上不返回任何内容,但在本地计算机上返回test : The dashboard function is called by the route /admin/dashboard /** * Dashboard page * * @return view */ public function dashboard(Request $request) { echo '<pre>'; var_dump($request->all()); echo '</pre>'; // Return here return; // …instead of here return view('backend::pages.dashboard'); } 我使用Nginx和php5-fpm在Ubuntu 14.04 LTS上运行Laravel 5.1。 该代码在我的本地Homestead实例以及MAMP上正常工作。 我检查了我的Nginxconfiguration,一切似乎都很好。 我在我的服务器上托pipe多个网站,我可以在所有其他网站上获取路由参数。

在nginx isntall之后没有findLaravel路由

将ICG更改为nginx后,除索引页外的所有路由都不起作用。 Laravelconfiguration: #/etc/nginx/sites-enabled/laravel server { listen 80; root /var/www/home; index index.php; server_name 192.168.178.71; access_log /var/www/home/storage/app/logs/laravel-nginx-access.log; error_log /var/www/home/storage/app/logs/laravel-nginx-error.log error; location /home { root /home/public; try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } # ERROR error_page 404 /index.php; # DENY HTACCESS location […]

错误的__DIR__魔术常数值

我一直在试图安装一个使用Laravel框架构build的Web应用程序。 该应用程序作为GIT存储库托pipe。 这里是我的问题的详细描述,以澄清我如何面对它。 我第一次克隆了以下path中的存储库: /var/www/app.example.com/script/ 然后创build一个符号链接到它的public目录,像这样遵循我的服务器的nginx路由约定: ln -s /var/www/app.example.com/script/public /var/www/app.example.com/public_html 但是我决定把所有的东西都从script目录移到一个更高的层次,这就是我的问题开始的地方。 我把Laravel安装到了/var/www/app.example.com/并让nginx直接加载它的public目录作为根path。 现在问题是我每次尝试加载应用程序时都试图从他们以前的位置读取文件: 警告:require(/var/www/app.example.com/script/public/../ bootstrap / autoload.php):无法打开stream:在/var/www/app.example.com中没有这样的文件或目录/public/index.php在第21行 致命错误:require():打开所需的失败'/var/www/app.example.com/script/public/../bootstrap/autoload.php'(include_path ='。:/ usr / share / php:/ usr / share / pear')在第21行的/var/www/app.example.com/public/index.php中 请注意: 我用composer来安装所有的依赖关系 curl -sS https://getcomposer.org/installer | PHP php composer.phar安装 我使用nginx作为我的networking服务器 我已经尝试删除一切(包括~/.composer ),并重新开始无济于事。 我甚至试图把整个项目移到一个新的根目录 似乎问题是与__DIR__魔术常量,因为它包含错误的path 奇怪的是,如果我回声__DIR__它打印正确的path,但在它使用的下一行它有不正确的旧path 我希望我的描述清楚,避免混乱和可能的反对票。

Laravel社交网站 – 谷歌login失败“缺less所需的参数:client_id”尽pipe指定

我有使用Laravel Socialite通过Google APIlogin用户的这个奇怪的问题。 所有的configuration看起来都很普通,但是我一直在收到错误, Missing required parameter: client_id 。 不仅如此,有时我再次尝试,错误成为Missing required parameter: redirect_uri尽pipe所有这些参数已经提供。 这是如何设置的: service.php 'google' => [ 'client_id' => 'xxxxxxxxxx-x98asxxxx913ofk5tqvgq7lqfpgdi5u2.apps.googleusercontent.com', 'client_secret' => 'mklOWJFhpbCzTKxxxx-xxxx', 'redirect' => 'http://myapp.com/auth/google/callback' ], routes.php文件 Route::get('/auth/{social_channel}', 'Auth\AuthController@redirect_to_provider'); Route::get('/auth/{social_channel}/callback', 'Auth\AuthController@handle_provider_callback'); AuthController.php /** * Redirect the user to the Google authentication page. * * @return Response */ public function redirect_to_provider($social_channel) { return Socialite::driver($social_channel)->redirect(); […]

当使用LaraDock运行Laravel和Nginx时,找不到文件

我正在学习Laravel使用它的教程。 我使用LaraDock安装了Laravel和所需的堆栈。 当我转到应用程序运行的IP地址时,Nginx返回File not found。 以下是我的NGINXconfiguration。 server { root /var/www/laravel/public/; listen 80 default_server; listen [::]:80 default_server ipv6only=on; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_pass php-upstream; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } […]

拉拉维尔,我怎么能忽略一条特殊的路线?

我怎么能忽略与nginx服务器的特殊路线。 例如我有一个a.com地址,我想忽略a.com/abc

NGINX在单个域上的多个Laravel项目

在工作中,我们有一个单独的临时域名服务器,例如https://staging.example.com 。 我们最近决定在一台新的服务器上从Apache切换到NGINX,并且我们遇到了Laravel路由问题。 我们所有的laravel应用程序都位于登台服务器上的子目录中,像这样。 https://staging.example.com/app1/public https://staging.example.com/app2/public 我已经尝试configurationLaravel文档中指定的NGINX conf文件,但在访问任何二级路由时获取404,即https://staging.example.com/app1/public/a/b 使用类似下面的configuration,我可以访问应用程序中的所有路线。 location @laravel { rewrite /app1/public/(.*)$ /app1/public/index.php?$1; } location / { try_files $uri $uri/ @laravel; } 但是,我们有很多应用程序托pipe在这个服务器上,我们不希望每次我们想要添加一个应用程序到服务器时都需要更新一个NGINX conf文件。 有没有办法构build一个适用于任何子目录的重写,并保持Laravel的路由系统工作? 注意:我也试过这个重写rewrite (.*)/(.*)$ $1/index.php?$2 ,并且不适用于二级路线。