我无法使用 nginx 1.6 设置虚拟主机

我无法使用 nginx 1.6 设置虚拟主机


我正在尝试在我的 nginx 服务器上设置更多虚拟主机。
但只有在 nginx 1.2 上创建的虚拟主机才有效,如果我尝试添加其他虚拟主机,它会重定向到我拥有 nginx 页面的默认配置。
我的配置:

server {
        server_name git.example.com;
        listen 8080;
        root /usr/share/nginx/www/gitexample;
        return 301 https://example.com$request_uri;
        }
# HTTPS server
#
server {
    server_name  git.example.com;
    listen 443;

    root /usr/share/nginx/www/gitexample/web/;
    index app.php;
    try_files $uri $uri/ /app.php?$query_string;

    ssl on;
    ssl_certificate /usr/share/nginx/www/gitexample.com/example.com.crt;
    ssl_certificate_key /usr/share/nginx/www/gitexample.com/example.com.key;

    ssl_session_timeout 5m;

    ssl_protocols SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    ssl_prefer_server_ciphers on;
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff)$ {
        expires 30d;
        add_header Vary Accept-Encoding;
        access_log off;
    }
location /socket {
        access_log off;
        proxy_pass http://socketserver;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;

    }
  location ~ ^/(app_dev|app_test.php|app)\.php(/|$) {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass php5-fpm-sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors on;
  }
  location /uploads/ { 
    location ~ .*\.(php).*$ 
    { 
    deny all; 
    } 
        }
}
upstream socketserver {
        server example.com:8080;
}       

相关内容