php - Laravel4-nginx-fpm file not found on rewrite -
hello using laravel 4 on nginx fastcgi, pretty new nginx , fastcgi.
the situation when use urls $doc_root/index.php?my_uri works when try pretty urls not work.
this nginx configuration
server { listen 80; server_name localhost; rewrite_log on; index index.php; root /home/mostafa/public_html; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { try_files $uri $uri/ /index.php?$query_string; } if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; } #error_page 404 /404.html; # redirect server error pages static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy php scripts apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} #pass php scripts fastcgi server listening on 127.0.0.1:9000 location ~* \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; include fastcgi_params; fastcgi_param script_filename /home/mostafa/public_html$fastcgi_script_name; } # deny access .htaccess files, if apache's document root # concurs nginx's 1 # location ~ /\.ht { deny all; } location ~* \.(?:ico|css|js|jpe?g|jpg|png|svg|woff)$ { expires 365d; } }
and fastcgi file
;prefix = /path/to/pools/$pool ; unix user/group of processes ; note: user mandatory. if group not set, default user's group ; used. user = www-data group = www-data ; address on accept fastcgi requests. ; valid syntaxes are: ; 'ip.add.re.ss:port' - listen on tcp socket specific address on ; specific port; ; 'port' - listen on tcp socket addresses on ; specific port; ; '/path/to/unix/socket' - listen on unix socket. ; note: value mandatory. listen = /var/run/php5-fpm.sock
the case when try url http://localhost/laravel-master/public/index.php?current
works , when try out index.php not work, , gives file not found , in error log says
fastcgi sent in stderr: "primary script unknown" while reading
although according tutorial should work
http://daylerees.com/nginx-configuration-for-daylerees-dot-com
ok after searching few while , many try outs, found error in nginx config document root, must set laravel-master/public/
the error getting because rewritten urls forwarded $document_root/index.php
localhost/index.php
of course not exist, changing document root laravel master did trick , urls rewritten localhost/laravel-master/public/index.php
Comments
Post a Comment