.PHP specific Laravel route and NGINX issue -
i deploying laravel application on nginx
i have route specified in routes.php handling non-blade php files , of blade php files
route::any('/{pagephp}.php',function($pagephp) { return view::make($pagephp); //this handle .php blades });
but no input file specified error whenever try access files such terms.blade.php note not error when access specified routes. e.g. have signin.blade.php have
route::get('/signin',function() { return view::make('signin'); });
when looked in error log see
[error] 969#0: *91 fastcgi sent in stderr: "unable open primary script: /var/www/xxxx/public/terms.php (no such file or directory)" while reading response header upstream, client: xxxxxxxx, server: xxxx, request: "get /terms.php http/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host:
as per error, nginx trying terms.php in public directory , not sending route.php there way fix this?
my nginx config file follows
server { # port web server listen on. listen 80; # host serve project. server_name xxxx; # useful logs debug. access_log /var/www/xxxx/app/storage/logs/access.log; error_log /var/www/xxxx/app/storage/logs/error.log; rewrite_log on; # location of our projects public directory. root /var/www/xxxx/public; # point index laravel front controller. index index.php; location / { # urls attempt, including pretty ones. try_files $uri $uri/ /index.php?$query_string; } # remove trailing slash please routing system. if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; } # php fpm configuration. location ~* \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; include /etc/nginx/fastcgi_params; fastcgi_param script_filename $document_root$fastcgi_script_name; } # don't need .ht files nginx. location ~ /\.ht { deny all; } # set header expirations on per-project basis location ~* \.(?:ico|css|js|jpe?g|jpg|png|svg|woff)$ { expires 365d; }
}
if these files not belongs laravel framework should not on directory if in case want test particular php script can put in public folder , accessible via yourdomain.com/script.php
Comments
Post a Comment