You need to configure a clean URL to use Drupal 8 on the nginx server I found many options for configuration files. They all look different, and I tried to use different options, but they all did not work the way I should.

Now my config looks like this:

server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html index.php; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.php?$query_string @rewrite; } location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php(/|$) { # try_files $uri $uri/ @rewrite; fastcgi_split_path_info ^(.+?\.php)(|/.*)$; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } 

So, if you refer to the section, for example, administration at the address of the form index.php/admin , then everything works successfully. However, if you contact /admin , then the error No input file specified is output.

What should the configuration look like so that the URL is correctly recognized in both cases?

    1 answer 1

     server { server_name example.com; root /var/www/example; index index.php; error_log /var/www/log/example_error.log; location ~ \..*/.*\.php$ { return 403; } # Block access to hidden directories location ~ (^|/)\. { return 403; } location ~ ^/sites/.*/private/ { return 403; } # No php is touched for static content location / { try_files $uri @rewrite; } # pass the PHP scripts to FastCGI server location ~ \.php$ { fastcgi_index index.php; try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; # The address or socket on which FastCGI requests are accepted. Set yours in www.conf fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # Clean URLs location @rewrite { rewrite ^ /index.php; } # Image styles location ~ ^/sites/.*/files/styles/ { try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } } 
    • I do not want to rewrite the entire config again, especially on my local host and there are sites on other engines. There are no other options? - Byulent