Nginx的Magentoconfigurationindex.php循环错误

我试图在Nginx上设置Magento,但不断收到以下错误

* 41在处理“/index.php”时重写或内部redirect周期

我的这个域的configuration文件如下,我用DOMAIN.inforeplace了我的域

我还评论了一些与SSL相关的部分,因为我还没有安装SSL

任何帮助将大规模赞赏。

server { # Listen on port 80 as well as post 443 for SSL connections. listen 80; listen 443 default ssl; server_name DOMAIN.info www.DOMAIN.info; # Specify path to your SSL certificates. #ssl_certificate /etc/nginx/certificates/yourcertificate.crt; #ssl_certificate_key /etc/nginx/certificates/yourcertificate.key; # Path to the files in which you wish to # store your access and error logs. access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # If the site is accessed via yourdomain.com # automatically redirect to www.yourdomain.com. if ($host = 'DOMAIN.info' ) { rewrite ^/(.*)$ http://www.DOMAIN.info/$1permanent; } root usr/share/nginx/www; location / { index index.html index.php; try_files $uri $uri/ @handler; } # Deny access to specific directories no one # in particular needs access to anyways. 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 only those who have a login name and password # to view the export folder. Refer to /etc/nginx/htpassword. location /var/export/ { auth_basic "Restricted"; auth_basic_user_file htpasswd; autoindex on; } # Deny all attempts to access hidden files # such as .htaccess, .htpasswd, etc... location ~ /\. { deny all; access_log off; log_not_found off; } # This redirect is added so to use Magentos # common front handler when handling incoming URLs. location @handler { rewrite / /index.php; } # Forward paths such as /js/index.php/x.js # to their relevant handler. location ~ .php/ { rewrite ^(.*.php)/ $1 last; } # Handle the exectution of .php files. location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass 127.0.0.1:9000; fastcgi_param HTTPS $fastcgi_https; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_CODE default; fastcgi_param MAGE_RUN_TYPE store; include fastcgi_params; } } 

我的nginx.conf文件看起来像这样

 user www-data; worker_processes 5; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # SSL Support ## map $scheme $fastcgi_https { default off; https on; } ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # 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"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # 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; # } #} 

这个问题很可能是缺少“/”的

 root usr/share/nginx/www; 

以及事实上,你的配置确实创建无限循环,如果/index.php无法找到:

 location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } ... 

请注意,如果-e $request_filename测试失败,那么对/index.php的请求将被重定向到/index.php。 请求将被再次匹配相同的位置,测试将再次失败等等 – 直到nginx会注意到有太多的内部重定向和中止请求处理与上述错误。