Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx 500 Internal Server Error

Tags:

nginx

When I access 127.0.0.1:6789 it works fine, but when i try to access something like 127.0.0.1:6789/busca.html?q=a, I got 500 Internal Server Error

this is my nginx config file

server {

    listen   88;


    root /vagrant/rizqcursosonline/rizqcursosonline/frontend/wwwpublic;
    index index.php index.html index.htm;

    server_name example.com;

    location / {
            try_files $uri $uri/ /index.html;                
    }

    error_page 404 /404.html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
          root /vagrant/rizqcursosonline/rizqcursosonline/frontend/wwwpublic/;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;

    }

}

nginx log error

2014/04/12 18:16:32 [error] 4165#0: *5 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 10.0.2.2, server: example.com, request: "GET /busca.html?q=a HTTP/1.1", host: "127.0.0.1:6789", referrer: "http://127.0.0.1:6789/"

2014/04/12 18:16:32 [error] 4165#0: *7 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 10.0.2.2, server: example.com, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1:6789"

like image 942
user1666651 Avatar asked Apr 12 '14 18:04

user1666651


People also ask

How do I fix NGINX 500 internal server error?

Disable VPN If you're connected to a VPN, there's a chance that the site you're trying to visit is geo-restricted for the area you're using your VPN from and hence you'll end up seeing the Nginx 500 error. Try disconnecting from the VPN to see if that solves the problem.

How do I fix a 500 Internal server error?

Clear your browser cache and cookies Check these articles on deleting the cache on an Android phone or iPhone, if you use a mobile device. Alternatively, you can test opening the page from another browser. For instance, if you use Chrome, try Firefox or vice versa.

What causes a 500 internal server error?

The 500 Internal Server error could be caused by an error during the execution of any policy within Edge or by an error on the target/backend server. The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request.


1 Answers

instead of

try_files $uri $uri/ /index.html;

I used

try_files $uri/ $uri /index.php?$query_string;
like image 62
user1666651 Avatar answered Sep 27 '22 19:09

user1666651