Question

Config en nginx cause ERR_TOO_MANY_REDIRECTS.

Hi. sorry for my bad English. I’m getting the following error on my site. Esta página web tiene un bucle de redirección ERR_TOO_MANY_REDIRECTS.

I configured nginx I have 2 domains following this tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts

the url that gives the error is drupal-test.libre.coop

servers blocks are:

drupal-test.libre.coop.conf ```code`````` server { listen 80; listen [::]:80;

server_name drupal-test.libre.coop; #server_name 107.170.12.18; root /usr/share/nginx/html/drupal-test.libre.coop; index index.php index.html index.htm;

access_log /var/log/drupaltest/drupaltest.access.log; error_log /var/log/drupaltest/drupaltest.error.log; location / { try_files $uri $uri/ /index.php?q=$uri&$args; }

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/nginx/html/drupal-test.libre.coop;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm-107.170.12.18.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

}


**mapa.conf**

server { set $site_name 107.170.12.18;

listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

listen *:80;

server_name 107.170.12.18;

server_name mapatest.libre.coop; access_log /var/log/mapasculturais/mapa.access.log; error_log /var/log/mapasculturais/mapa.error.log;

index index.php; root /srv/mapas/mapasculturais/src/;

location / { try_files $uri $uri/ /index.php?$args; }

location ~* .(js|css|png|jpg|jpeg|gif|ico|woff)$ { expires 1w; log_not_found off; }

location ~ .php$ { try_files $uri =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/var/run/php5-fpm-$site_name.sock; client_max_body_size 20M; } charset utf-8; }

server { listen *:80; server_name 107.170.12.18;

return 301 $scheme://107.170.12.18$request_uri; client_max_body_size 20M; }


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

muchas gracias por las respuestas saludos

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 66536;
          use epoll;
          multi_accept on;
}

http {

        add_header rt-Fastcgi-Cache $upstream_cache_status;
        fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
        fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;


        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;

        default_type application/octet-stream;
        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        server_tokens off;
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_min_length 256;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/ld+json application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf  font/eot font/opentype font/otf image/svg+xml image/vnd.microsoft.icon;
        gzip_disable "MSIE [1-6]\.";
        #set client body size to 2M #
        client_max_body_size 20M;
        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##
        include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
#               protocol   imap;
#               proxy      on;
#       }
#}

 }
  charset utf-8;
}