I'm trying to have access to my web-app through this address: but it doesn't work. I get an error HTTP301/Moved permanetly.

I can have access just if I go through the slash in the end:

I tried to check output of curl command, it is redirecting from to but after redirect, app doesn't run. I just get an error in the browser: "Connection refused". Nginx service is running. -t output is correct

How to change this behavior?

This is my nginx full config:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;

http {
    include       /etc/nginx/mime.types;
#    include      /etc/nginx/sites-enabled/*;
    #include      /etc/nginx/conf.d/*.conf;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;

# configuration file /etc/nginx/conf.d/default.conf:
server {
    listen 80;
    server_name localhost;
    root /usr/share/nginx/html;
    index index.php index.html index.htm index.nginx-debian.html;

    location /rukovoditel {
#        root /usr/share/nginx/html;
        index index.php  index.htm index.nginx-debian.html;

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

    location ~ \.php$ {
            include fastcgi_params;
            fastcgi_intercept_errors on;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

    location ~ /\.ht {
        deny all;

And access log: - - [13/Feb/2020:16:40:21 +0000] "GET /rukovoditel HTTP/1.1" 301 169 "-" "curl/7.58.0" "-" - - [13/Feb/2020:16:41:55 +0000] "GET /rukovoditel/ HTTP/1.1" 302 5 "-" "curl/7.58.0" "-"
  • Show the output of curl -I and curl -I – Richard Smith Feb 14 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.