Windows 中 Nginx 上的 Magento 安装问题

Windows 中 Nginx 上的 Magento 安装问题

我正在尝试使用 nginx 而不是 Apache 作为 Web 服务器在本地安装 magento。我将 magento 文件夹复制到 html 目录。当我尝试调用 magento 文件夹时,出现 404 未找到错误。我可以访问 html 文件夹中设置的其他 php 文件,并且已安装 PHP。这是我的配置文件:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
            allow all;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  c:/nginx/html/$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

我该如何修复这个问题?这是我在 error.log 文件中发现的内容:

2011/09/06 12:22:35 [error] 5632#0: *1
"/cygdrive/c/nginx/html/magento/index.php/install/index.html" is not
found (20: Not a directory), client: 127.0.0.1, server: localhost,
request: "GET /magento/index.php/install/ HTTP/1.1", host:
"localhost:8080"

答案1

将此设置从:

        location ~ \.php$ 
    {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  c:/nginx/html/$fastcgi_script_name;
        include        fastcgi_params;
    }

到:

           location ~ ^(.+\.php)(.*)$ 
    {

           root           /usr/share/nginx/html;
           fastcgi_split_path_info ^(.+\.php)(.*)$;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
           fastcgi_param PATH_INFO $fastcgi_script_name;
           include        fastcgi_params;
    }

我在另一个网站上找到一篇这样的帖子后,几个小时的工作就让我得到了回报。你应该在找到解决方案后回复这篇帖子。

相关内容