Using NginX and Laravel: URL Rewrites

二次信任 提交于 2019-12-06 13:56:07

I am not very familiar with Nginx, but I do think that your regex for the rewrite is incorrect.

Try changing

rewrite ^/(.*)$ /index.php?/$1 last;

To:

rewrite ^/(.*)$ /index.php/$1 last;

Or:

rewrite ^.*$ /index.php last;

Fábio N Lima

Here is my nginx / Laravel configuration (Debian in Linode):

# Laravel 4 nginx configuration
server {

        server_name www.yourdomain.com;

        access_log /var/www/yourdomain.com/log/access.log;
        error_log /var/www/yourdomain.com/log/error.log;

        root /var/www/yourdomain.com/public;
        index index.php index.html index.htm;

        location / {
                 try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {

                # With php5-fpm:
                include /opt/nginx/conf/fastcgi_params; #Here you need to point your nginx instalation directory
                fastcgi_pass unix:/var/run/php5-fpm.sock; #Use this config if you are using sock or use fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        }

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!