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

Update NGINX config for Symfony app #1466

Open
LemoineSimon opened this issue Dec 6, 2022 · 0 comments
Open

Update NGINX config for Symfony app #1466

LemoineSimon opened this issue Dec 6, 2022 · 0 comments
Labels
bug Something isn't working generator/symfony

Comments

@LemoineSimon
Copy link

The generated NGINX configuration for Symfony app not working without changes.

Example changement:
From:

location /sf/ {
    root /home/sf/current/public;

    try_files $uri /index.php$is_args$args;

    location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/run/php/sf-{{ sf_php_version }}.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        internal;
    }

    location ~ \.php$ {
        return 404;
    }
}

To:

location /sf/ {
    alias /home/sf/current/public/;

    try_files $uri /sf//sf/index.php$is_args$args;

    location ~ ^/sf/index\.php(/|$) {
        root /home/sf/current/public;
        fastcgi_pass unix:/run/php/sf-{{ sf_php_version }}.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        internal;
    }

    location ~ \.php$ {
        return 404;
    }
}
  • Change first location root directive to alias
  • Update try_files directive
  • Update nested location
  • Add root directive to this nested location
  • Update fastcgi_param SCRIPT_FILENAME
@jvasseur jvasseur added bug Something isn't working generator/symfony labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working generator/symfony
Projects
None yet
Development

No branches or pull requests

2 participants