使用Shopware的Nginx下的子域

使用Shopware的Nginx下的子域,nginx,subdomain,Nginx,Subdomain,你好,我有以下配置: server { listen 80; server_name example.com; client_max_body_size 24M; client_body_buffer_size 128k; server_name www.example.com; root /www/example.com/htdocs/; # Include shopware configuration. include /www/example.com/config/shopware.co

你好,我有以下配置:

server {
listen 80;
server_name example.com;
client_max_body_size 24M;
client_body_buffer_size 128k;
server_name www.example.com;
root /www/example.com/htdocs/;

# Include shopware configuration.
include /www/example.com/config/shopware.conf;
}

server {
listen 80;
server_name subdomain.example.com;

client_max_body_size 24M;
client_body_buffer_size 128k;

root /www/example.com/subdomain/;

# Include shopware configuration.
include /www/example.com/config/shopware.conf;
}

server {
listen 443;
server_name example.com;

# SSL
ssl on;
ssl_certificate /etc/ssl/private/www.example.com.crt;
ssl_certificate_key /etc/ssl/private/www.example.com.key;
ssl_ciphers               SSLv3+HIGH:RC4+MEDIUM:!aNULL:!eNULL:!3DES:!MD5:@STRENGTH;
ssl_prefer_server_ciphers on;
ssl_protocols             SSLv3;
ssl_session_cache         shared:SSL:10m;

client_max_body_size 24M;
client_body_buffer_size 128k;

server_name example.com;
root /www/example.com/htdocs/;

# Include shopware configuration.
include /www/example.com/config/shopware.conf;
}
问题是,当我试图打开subdomain.example.com时,我会得到一个未找到的

环境

nginx version: nginx/0.7.67
debian 6.0.7
shopware.conf:

## File: /etc/nginx/global/shopware.conf
## Author: Benjamin Cremer 
## Shopware 4 Nginx rules.
## Designed to be included in any server {} block.

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location = /templates/_default/backend/_resources/resources/css/icon-set.css {
gzip off;
}

## Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

## Deny all attems to access possible configuration files
location ~ \.(tpl|yml|ini)$ {
deny all;
}

## Deny access to media upload folder
location ^~ /media/temp/ {
deny all;
}

location ^~ /cache/ {
deny all;
}

location ^~ /files/documents/ {
deny all;
}

# Breaks backend/media/ rewrite
#
#location ~ /(engine|files|templates|media)/ {
#    location ~ \.php$ {
#        return 403;
#    }
#}

location /check/ {
index index.php;
try_files $uri /check/index.php?$args;
}

location /install {
index index.php;
try_files $uri /install/index.php?$args;
}


location / {
index index.html index.php shopware.php
            rewrite shopware.dll /shopware.php;
            rewrite files/documents/.* /engine last;
            rewrite images/ayww/(.*) /images/banner/$1 last;
            rewrite backend/media/(.*) media/$1 last;
            if (!-e $request_filename){
                rewrite . /shopware.php last;
            }
## Defining rewrite rules
# rewrite ^ https://www.kotel.de permanent;
#rewrite files/documents/.* /engine last;
#rewrite backend/media/(.*) /media/$1 last;

location ~* ^.+\.(?:css|js|jpe?g|gif|ico|png|html|xml)$ {
    expires 1w;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";

    access_log off;



    # The directive enables or disables messages in error_log about files not found on disk.
    log_not_found off;

    tcp_nodelay off;
    ## Set the OS file cache.
    open_file_cache max=3000 inactive=120s;
    open_file_cache_valid 45s;
    open_file_cache_min_uses 2;
    open_file_cache_errors off;
}

index shopware.php index.php;
try_files $uri $uri/ /shopware.php?$args;
}

## XML Sitemap support.
location = /sitemap.xml {
try_files $uri /shopware.php?controller=SitemapXml;
}

location ~ \.php$ {
try_files $uri =404;

## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_split_path_info ^(.+\.php)(/.+)$;

#fastcgi_keep_conn on;

fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name;
include fastcgi_params;

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

fastcgi_pass php-fpm;
}
谁能给我一些忠告,告诉我做错了什么

谢谢,
Steven

正如您在配置文件中列出的,您的子域如下所示

server {
    listen 80;
    server_name subdomain.example.com;

    client_max_body_size 24M;
    client_body_buffer_size 128k;

    root /www/example.com/subdomain/;

    # Include shopware configuration.
    include /www/example.com/config/shopware.conf;
}
编辑: 因此在shopware.conf中有一行写着
fastcgi\u pass php fpm,我不确定这是否正常工作,如果您遇到严重的网关错误,那么这就是您需要解决的问题,请尝试用这些行中的任何一行替换它,看看哪个行可以工作

fastcgi_pass unix:/var/run/php5-fpm.sock;


我认为其中一个应该可以工作

好的,所以我没有找到任何合适的
fastcgi_pass
,但是在shopware文件的末尾有一个,我认为您需要更改它,我将编辑答案并显示使用nginx运行shopware的最新配置,可以在这里找到:
fastcgi_pass 127.0.0.1:9000;