nginx 无法启动多个 nodejs 应用程序

nginx 无法启动多个 nodejs 应用程序

我在 sites-enabled/default 中有此配置

upstream domainone.com.ar {
    server 127.0.0.1:9000;
}
server {
listen   80;
server_name  www.domainone.com.ar;
rewrite ^/(.*) http://domainone.com.ar/$1 permanent;
}
server {
    listen 80;
    listen [::]:80 ipv6only=on;
    server_name domainone.com.ar;
    #access_log /var/log/nginx/example1.com/access.log;
    location / {
      if ($request_uri ~* \.(ico|css|js|gif|jpe?g|png)$) {
          expires 168h; 
          break;
      }
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass http://domainone.com.ar;
      proxy_redirect off;
    }
}


upstream domaintwo.com.ar {
    server 127.0.0.1:8000;
}
server {
listen   80;
server_name  domaintwo.com.ar;
rewrite ^/(.*) http://domaintwo.com.ar/$1 permanent;
}
server {
    listen 80;
    listen [::]:80 ipv6only=on;
    server_name www.domaintwo.com.ar;
    #access_log /var/log/nginx/example1.com/access.log;
    location / {
      if ($request_uri ~* \.(ico|css|js|gif|jpe?g|png)$) {
          expires 168h; 
          break;
      }
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass http://domaintwo.com.ar;
      proxy_redirect off;
    }
}

当我尝试启动 /etc/init.d/nginx 时...什么都没有发生...没有错误没有日志没有任何内容...我的服务器是云服务器 debian 6,64 位 nodejs v0.10 nginx 1.2.6 配置有问题???

答案1

如果您不需要 IPv6,则必须注释掉第 11 行和第 39 行(listen [::]:80 ipv6only=on;)。否则,您必须删除 ipv6only=on 指令

相关内容