nginx 没有显示子域名的正确根目录

nginx 没有显示子域名的正确根目录

我有一个带有 magento 商店的子域名,至少这是我想要的。

看来 nginx 由于某种原因没有检测到它,而只是提供默认根服务。

因此,当我输入 songportal.ottawakaraoke.com 时,它会返回 ottawakaraoke.com 上的内容 - 但 silly.ottawakaroke.com 会抛出 404。

这是我的配置:

server {
    listen 80;
    server_name songportal.ottawakaraoke.com;
    access_log /var/www/songportal.ottawakaraoke.com/logs/access.log;
    error_log /var/www/songportal.ottawakaraoke.com/logs/error.log;
    root /var/www/songportal.ottawakaraoke.com/public_html/;

    location / {
        index index.php;
    }


    ## Main Magento location
    location @handler {
       rewrite / /index.php;
     }

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


    ####################################################################################

    ## Execute PHP scripts
    location ~ .php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_send_timeout 1800;
        fastcgi_read_timeout 1800;
        fastcgi_connect_timeout 1800;
        ## Store code with multi domain
        #fastcgi_param  MAGE_RUN_CODE $storecode;
        ## Default Store code
        fastcgi_param  MAGE_RUN_CODE default; 
        fastcgi_param  MAGE_RUN_TYPE store; ## or website;
        include        fastcgi_params; ## See /etc/nginx/fastcgi_params
        }



#    location ~ \.php$ {
#        include /etc/nginx/fastcgi_params;
#        fastcgi_pass  127.0.0.1:9000;
#        fastcgi_index index.php;
#        fastcgi_param SCRIPT_FILENAME $request_filename;
#    }
}

在我的主 nginx 配置中,我有此行,提取所有适当的 sites_enabled/available 配置

    # The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;

## Load virtual host conf files. ##
include /etc/nginx/sites-enabled/*;

任何想法都是很棒的,我已经研究这个问题有一段时间了。

相关内容