Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx: improve laravel conf & add sub directory install support #170

Open
joglomedia opened this issue Jun 3, 2024 · 0 comments
Open

Nginx: improve laravel conf & add sub directory install support #170

joglomedia opened this issue Jun 3, 2024 · 0 comments
Assignees

Comments

@joglomedia
Copy link
Owner

Add this

# Remove trailing slash to please routing system.
if (!-d $request_filename) {
    rewrite     ^/(.+)/$ /$1 permanent;
}

after / location block


Sub directory install config

    # version 1
    location ^~ /demo1 {
        alias /home/tom/public_html/demos/demo1/public;
        try_files $uri $uri/ @demo1;

        location ~* \.php {
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            include /etc/nginx/fastcgi_params;
        }
    }

    location @demo1 {
        rewrite ^/demo1/(.*)$ /demo1/index.php/$1 last; # THIS IS THE IMPORTANT LINE
    }
    # end version 1

    # version 2
    # this is with `ln -s /home/tom/public_html/demos/demo1/public <document root>/demo1`
    location ~ /demo1 {
        try_files /demo1/$uri /demo1/$uri/ /demo1/index.php?q=$uri&$args;
    }
    # end version 2

Ref: https://gist.github.com/tsolar/8d45ed05bcff8eb75404

@joglomedia joglomedia self-assigned this Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant