0

您好,我有以下配置:

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 时,我得到一个 NOT FOUND。

环境

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;
}

谁能给我一些平静的建议,我做错了什么?

谢谢,史蒂文

4

1 回答 1

0

正如您在 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;
}

编辑:所以在 shopware.conf 里面有一行说fastcgi_pass php-fpm;,我不确定这是否正常工作,如果你遇到错误的网关错误,那么这就是你需要修复的,尝试用其中任何一个替换它行,看看哪些有效

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

或者

fastcgi_pass 127.0.0.1:9000;

我认为其中一个应该工作

于 2013-07-10T13:48:50.383 回答