2

我尝试使用 Nginx 和 php-fpm 将 Magento 社区版安装到我的 VPS(在 Linode 上),但我做不到。我将 Magento 1.8.1.0 下载到我的服务器。我创建了像Magento Wiki这样的 nginx 配置。但是当我请求我的域时,它会通过 302 标头重定向到“/index.php/install/”路径,并且浏览器会出现无限循环错误。

你能建议一个解决方法吗?

编辑:我的 nginx 配置文件(我将真实域名替换为 mydomain)

server {
  server_name mydomain.com www.mydomain.com;
  root "/home/mydomain/public_html";

  index index.php;
  client_max_body_size 10m;

    access_log /home/mydomain/_logs/access.log;
    error_log /home/mydomain/_logs/error.log;

    if ($http_user_agent ~* (Baiduspider|webalta|nikto|wkito|pikto|scan|acunetix|morfeus|webcollage|youdao) ) {
       return 401;
    }

    if ($http_user_agent ~* (HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) ) {
       return 401;
    }

    location / {
        index index.html index.php; ## Allow a static html file to be shown first
        try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
        expires 30d; ## Assume all files are cachable
    }

    ## These locations would be hidden by .htaccess normally
    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; }

    location /var/export/ { ## Allow admins only to view export folder
        auth_basic           "Restricted"; ## Message shown in login window
        auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
        autoindex            on;
    }

    location  /. { ## Disable .htaccess and other hidden files
        return 404;
    }

    location @handler { ## Magento uses a common front handler
        rewrite / /index.php;
    }

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

    location ~ "^(.+\.php)($|/)" {
        if (!-e $request_filename) { rewrite / /index.php last;  }

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param MAGE_RUN_CODE default;
        fastcgi_param MAGE_RUN_TYPE store;
        fastcgi_param HTTPS $https;

        fastcgi_pass   unix:/var/run/mydomain_fpm.sock;
        include        fastcgi_params;
    }


    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
            access_log off;
    }

    location ~* \.(html|htm)$ {
        expires 30m;
    }

    location ~* /\.(ht|git|svn) {
        deny  all;
    }
}
4

4 回答 4

0

基本上,如果你还没有 crated 数据库,那么 Nginx 和虚拟主机配置就会出现问题。

可能的故障将在您的浏览器的内存中。尝试清理它,或使用匿名机制。

尝试删除 magento 文件并创建一个简单的 index.php 文件,其中包含“hello”文本。如果可行,请尝试将 Magento 文件再次复制到此文件夹并运行安装。

请记住,您必须创建一个空数据库,用户对该数据库拥有所有权限。

第二个问题可能是安装错误,(您的 magento 已安装,并且您尝试再次连接安装程序,但这将重定向)。在这种情况下,安装有问题,请从数据库中删除表并再次运行安装。

于 2014-02-05T16:20:42.827 回答
0

问题是“默认”行有“https”,而“商店”行有“http”。

使用 PhpMyAdmin 执行此 SQL 命令:

SELECT * FROM `core_config_data` WHERE path like '%secure/base_url'

然后检查所有安全行是否以“https”开头。

于 2014-07-02T19:08:33.030 回答
0

我的文件如下所示:

server {
    listen 80 default;
    access_log /var/log/nginx/test.ssl.access.log;
    error_log /var/log/nginx/test.ssl.error.log;
    ssl off;
    root /var/www/shop;
    server_name sales.test.net.au;
    location / {
        index index.html index.php;
        try_files $uri $uri/ @handler;
        expires 30d;
    }
    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; }
    location /var/export/ { ## Allow admins only to view export folder
        auth_basic "Restricted"; ## Message shown in login window
        auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
        autoindex on;
    }
    location /. { ## Disable .htaccess and other hidden files
        return 404;
    }
    location @handler { ## Magento uses a common front handler
        rewrite / /index.php;
    }
    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
        rewrite ^(.*.php)/ $1 last;
    }
    location ~ .php$ { ## Execute PHP scripts
        if (!-e $request_filename) { rewrite / /index.php last; }
        expires off; ## Do not cache dynamic content
        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;
    }
    location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
               }
               location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }
}
server {
    listen 443 default;
    ssl on;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;
    access_log /var/log/nginx/test.ssl.access.log;
    error_log /var/log/nginx/test.ssl.error.log;
    server_name sales.test.net.au;
    root /var/www/shop;
    location / {
        index index.html index.php;
        try_files $uri $uri/ @handler;
        expires 30d;
    }
    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; }
    location /var/export/ { ## Allow admins only to view export folder
        auth_basic "Restricted"; ## Message shown in login window
        auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
        autoindex on;
    }
    location /. { ## Disable .htaccess and other hidden files
        return 404;
    }
    location @handler { ## Magento uses a common front handler
        rewrite / /index.php;
    }
    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
        rewrite ^(.*.php)/ $1 last;
    }
    location ~ .php$ { ## Execute PHP scripts
        if (!-e $request_filename) { rewrite / /index.php last; }
        expires off; ## Do not cache dynamic content
        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;
    }
    location /phpmyadmin {
               root /usr/share/;
               index index.php index.html index.htm;
               location ~ ^/phpmyadmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /usr/share/;
                       fastcgi_pass 127.0.0.1:9000;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
               }
               location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /usr/share/;
               }
        }
        location /phpMyAdmin {
               rewrite ^/* /phpmyadmin last;
        }
}

为我工作...

于 2014-06-18T17:03:23.067 回答
-3

Please check with your htaccess file. If it exists please check the existing rules

于 2014-02-06T06:55:24.550 回答