3

I did set NGINX for my server, and use DirectAdmin, also I changed nginx.conf for Magento configs, everything is ok but I have a problem with admin area!

I can not login to dashboard, login page appear only when I write in url admin without index.php, example:

http://www.example.com/adminurl/

but when I click on login, then url change to:

http://www.example.com/index.php/adminurl/

and page return 404 error!

How can I solve this issue?

Use NGINX instead of apache and in frontend every link work as well, but all of them working without index.php

  • After login you are redirecting to 404 ? – Bhupendra Jadeja Apr 22 '15 at 6:10
1

If the problem is caused by index.html and index.php my solution a problem I had yesterday may help with this

500 Internal Server Error when trying to access admin pages

1

Is this happening in frontend too?. I think is a problem with your nginx conf in rewriting URL, Did you have url write in magento set to yes? If you can give us more information would be great. Here is a copy of an old magento nginx conf. Just remove the things that you don't need.

server {                                              
    listen 80;
    #listen [::]:80 default_server ipv6only=on;
    listen 443 default ssl;
    server_name "Server name";

    #ssl_certificate_key /etc/nginx/ssl/tenlinea.key;
    #ssl_certificate     /etc/nginx/ssl/ssl_news/t_enlinea.crt;

    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    #ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
    ssl_prefer_server_ciphers on;

    index index.php;
   root   "Your root";                                     

location = /apc.php {
    deny all;
}  
        ## maintenance mode ##
         ######################

            set $maintenance on;
        #    if ($remote_addr ~ (8.8.8.8|8.8.4.4)) {
        #        set $maintenance off;              
        #    }                                      
        #    if ($uri ~ ^/(index.php/)?(paypal)/(.*)$ ) {
        #        set $maintenance off;                   
        #    }                                           
        #    if ($maintenance = on) {                    
        #        return 503;                             
        #    }                                           
        #    location /maintenance {}                    
        #    error_page 503 @maintenance;                
        #    location @maintenance {                     
        #        root /var/public_html/domain.com/maintenance;
        #        rewrite ^(.*)$ /index.html break;            
        #    }                                                

        ##########################                            
        ## end maintenance mode ##                            
        location /nginx_status {
        # Turn on stats
        #stub_status on;
        access_log   off;
        # only allow access from 192.168.1.5 #
        #allow 127.0.0.1;
        #deny all;
        allow all;
        }

        location = /favicon.ico {
                 try_files $uri =204;
        }                            
        location / {                 
        index index.html index.php; 


        ## If missing pass the URI to Magento's front handler
        #try_files $uri $uri/ =404; # @handler;                       
         #try_files $uri $uri/ @handler;

        try_files $uri $uri/ /index.php?$query_string;
          expires max; ## Enable max file cache                
        }                                                   

        ## These locations need to be denied
            location ^~ /app/                { deny all; }
            location ^~ /includes/           { deny all; }
            location ^~ /lib/                { deny all; }
            #location ^~ /media/downloadable/ { deny all; }
            location ^~ /pkginfo/            { deny all; }
            location ^~ /report/config.xml   { deny all; }
            location ^~ /var/                { deny all; }

        ## Allow admins only to view export directory
        ## Set up the password for any username using this command:
        ## htpasswd -c /etc/nginx/htpasswd magentoadmin            

        location /var/export/ { 
                auth_basic           "Restricted";
                auth_basic_user_file htpasswd; ## Defined at /etc/nginx/htpassword
                autoindex            on;                                          
            }                                                                     

        ## Disable .htaccess and other hidden files
       ## location  /. {
               ## return 404;
           ## }
        ## Magento uses a common front handler

    location /api {
    }
        ## Forward paths like /js/index.php/x.js to relevant handler
        location ~ .php/ {
                rewrite ^(.*.php)/ $1 last;

            }

        ## php-fpm parsing
        location ~ \.php$ {
    ####fastcgi_read_timeout 30000; 
    fastcgi_read_timeout 30000;
        ## Catch 404s that try_files miss
        if (!-e $request_filename) { rewrite / /index.php last; }

        ## Disable cache for php files
        expires        off;

        ## php-fpm configuration
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_param  HTTPS $fastcgi_https;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        #fastcgi_param  SCRIPT_FILENAME /var/www/html/magento$fastcgi_script_name;
        #include        fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        ###fastcgi_pass unix:/var/run/php5-fpm.sock;
        ###fastcgi_index index.php;
        ###fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
        # Store code is located at Administration > Configuration > Manage Stores in your Magento Installation.
        fastcgi_param  MAGE_RUN_CODE default;
        fastcgi_param  MAGE_RUN_TYPE store;

        ## Tweak fastcgi buffers, just in case.
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        include fastcgi_params;
        }
    location ~* ^.+\.(css|js|gif|png|jpg|jpeg)$ {
        expires max;
        add_header Pragma public;
        #add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        add_header Cache-Control "public";
     access_log off;
        }
    ##
    # Rewrite for versioned CSS+JS via filemtime
    ##
    location ~* ^.+\.(css|js)$ {
        #rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
        expires 31536000s;
        access_log off;
        log_not_found off;
        add_header Pragma public;
        add_header Cache-Control "max-age=31536000, public";
    }
    ##
    # Aggressive caching for static files
    # If you alter static files often, please use 
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    ##
    location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
        expires 31536000s;
        access_log off;
        log_not_found off;
        add_header Pragma public;
        add_header Cache-Control "max-age=86400, public";
    }

}
1

Open your phpmyadmin from your host try once this sql command...

Run this Sql

SET FOREIGN_KEY_CHECKS=0;
UPDATE core_store SET store_id = 0 WHERE code='admin';
UPDATE core_store_group SET group_id = 0 WHERE name='Default';
UPDATE core_website SET website_id = 0 WHERE code='admin';
UPDATE customer_group SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';SET FOREIGN_KEY_CHECKS=1;

Now admin can able to login.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.