jeudi 28 juillet 2016

Hosts file not redirecting URL when anything is after first slash

I have a Laravel 5 installation running on my VPS which is being used as an API. This has an internal DNS URL of http://brain.#####.co.uk. I have then created a entry in my hosts file on my machine that will redirect my request to my VPS and return results back from the API. Here is my hosts files entry on my machine (I have replaced my addresses with has for security):

46.**.*.***      brain.#####.co.uk
46.**.*.***      http://brain.#####.co.uk

And the hosts file on the VPS:

127.0.0.1       brain.#####.co.uk
127.0.0.1       http://#####.co.uk

and my nGinx server block:

server {
        listen 80;
        server_name brain.#####.co.uk http://brain.#####.co.uk;

        root /var/www/stdavids-brain/html/public/;
        index index.php index.html;

        sendfile off;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~* \.php {
            include fastcgi_params;

            fastcgi_pass unix:/var/run/php5-fpm.sock;

            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_cache off;
            fastcgi_index index.php;
        }
}

I have checked all the settings here and they work fine and it works fine when I run the installation in development on my local machine in a Vagrant box.

The issue I am having is when I visit the URL http://brain.#####.co.uk I get a Laravel page which is fine, but when I try to access a route http://brain.#####.co.uk/category I get a 404 error. I have used traceroute to ping the http://brain.#####.co.uk/category address and it seems like my request isn't even hitting my VPS. It hits the VPS when just http://brain.#####.co.uk is called though. I know this route exists and is working as I have it working locally.

Can anyone see what is going wrong here and offer advice?

Thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2acGU4N
via IFTTT

Aucun commentaire:

Enregistrer un commentaire