nginx上游模块无法正常工作

时间:2017-04-09 16:56:47

标签: nginx

[root @ ansible3 nginx] #cd vhost.d /

[root @ ansible3 vhost.d] #ls -rtlh

总计12K

-rw-R - R--。 1 root root 575 Apr 9 08:42 default.conf

-rw-R - R--。 1 root root 172 Apr 9 12:14 test.domainvhost.com.conf

-rw-R - R--。 1 root root 160 Apr 9 12:41 test.mynode.local.conf

[root @ ansible3 vhost.d] #pwd /etc/nginx/vhost.d

[root @ ansible3 vhost.d] #cat test.mynode.local.conf

上游mynode {

set.seed(789)
df1 <-   data.frame(
a = runif(100, 0, 100),
b = runif(100, 0, 100),
c = runif(100, 0, 100),
d = runif(100, 0, 100))

df2 <-   data.frame(
a = runif(100, 0, 100),
b = runif(100, 0, 100),
c = runif(100, 0, 100),
d = runif(100, 0, 100))

df3 <-   data.frame(
a = runif(100, 0, 100),
b = runif(100, 0, 100),
c = runif(100, 0, 100),
d = runif(100, 0, 100))

}

服务器{

 server localhost:9888;

}

}

[root @ ansible3 vhost.d]#

静态HTTP服务器在9888端口上运行,如下所示

root @ ansible3 vhost.d] #elinks http://localhost:9888

测试

所以,当我试图按下面运行时,我得到另一个输出而不是测试:( :(

[root @ ansible3 vhost.d] #elinks http://test.mynode.local

 server_name test.mynode.lcoal;

 location / {

             proxy_pass http://mynode;

                                                                        This is BHARATH WEB Server

我的/ etc / hosts如下所示

[root @ ansible3 vhost.d] #cat / etc / hosts

127.0.0.1 localhost localhost.localdomain localhost4 ansible3.bharath.com

:: 1 localhost localhost.localdomain localhost6

localhost6.localdomain6

10.0.3.127 test.domainvhost.com

10.0.3.127 test.mynode.local mynode

[root @ ansible3 vhost.d]#

和9888端口由我的节点JS静态http服务器运行,如下所示

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {

    worker_connections 1024;

}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   15;
    types_hash_max_size 2048;

   client_body_buffer_size 10k;
   client_header_buffer_size 1k;
   client_max_body_size 18m;
   large_client_header_buffers 2 1k;

   client_body_timeout 12;
   client_header_timeout 12;
   send_timeout 10;


    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/vhost.d/*.conf;

   # server {
   #     listen       80 default_server;
   #     listen       [::]:80 default_server;
   #     server_name  _;
   #     root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
   #     include /etc/nginx/default.d/*.conf;

   #     location / {
   #     }

   #     error_page 404 /404.html;
   #         location = /40x.html {
   #     }

   #     error_page 500 502 503 504 /50x.html;
   #         location = /50x.html {
   #     }
   # }

# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2 default_server;
#        listen       [::]:443 ssl http2 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
#        ssl_session_cache shared:SSL:1m;
#        ssl_session_timeout  10m;
#        ssl_ciphers HIGH:!aNULL:!MD5;
#        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }

}

我把它如下

[root @ ansible3 node]#node server3.js&amp;

[4] 6345

[root @ ansible3 node]#在

运行的静态文件服务器

=&GT; http://localhost:9888/

CTRL + C关闭

echo“test”&gt;的index.html

0 个答案:

没有答案