老师,我在配置nginx 反向代理nodejs端口,这一节中有一个问题

来源:7-1 配置 Nginx 反向代理 Nodejs 端口

js商博良

2017-04-12

报的是unknon http 变量 的错误

我的conf文件如下,只是服务器的IP隐藏了

希望能得到老师的讲解,谢谢

http://szimg.mukewang.com/58edef9a0001dc7b06570081.jpg

http://szimg.mukewang.com/58edef9a0001adcb06590352.jpg


写回答

3回答

Scott

2017-04-12

把这两个都注释掉:


# include /etc/nginx/conf.d/*.conf;

# include /etc/nginx/sites-enabled/*;


然后通过 sudo 来启动 Nginx 试试看呢?


另外,把  include /etc/nginx/conf.d/*.conf; 下面的文件代码也贴出来看下,我看 nginx.conf 的配置没什么问题,有点奇怪。

0
0

Scott

2017-04-12

把  /etc/nginx/nginx.conf 的内容贴一下,我看看怎么改

0
1
js商博良
老师,我贴出来了,非常感谢
2017-04-12
共1条回复

js商博良

提问者

2017-04-12

user www-data;

worker_processes 4;

pid /run/nginx.pid;


events {

        worker_connections 768;

        # multi_accept on;

}


http {


        ##

        # Basic Settings

        ##


        sendfile on;

        tcp_nopush on;

        tcp_nodelay on;

        keepalive_timeout 65;

        types_hash_max_size 2048;

        # server_tokens off;


        # server_names_hash_bucket_size 64;

        # server_name_in_redirect off;


        include /etc/nginx/mime.types;

        default_type application/octet-stream;


 ##

        # Logging Settings

        ##


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

        error_log /var/log/nginx/error.log;


        ##

        # Gzip Settings

        ##


        gzip on;

        gzip_disable "msie6";


        # gzip_vary on;

        # gzip_proxied any;

        # gzip_comp_level 6;

        # gzip_buffers 16 8k;

        # gzip_http_version 1.1;

            

# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;


        ##

        # nginx-naxsi config

        ##

        # Uncomment it if you installed nginx-naxsi

        ##


        #include /etc/nginx/naxsi_core.rules;


        ##

        # nginx-passenger config

        ##

        # Uncomment it if you installed nginx-passenger

        ##


        #passenger_root /usr;

        #passenger_ruby /usr/bin/ruby;


        ##

        # Virtual Host Configs

        ##


        include /etc/nginx/conf.d/*.conf;

include /etc/nginx/sites-enabled/*;

}



#mail {

#       # See sample authentication script at:

#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

#

#       # auth_http localhost/auth.php;

#       # pop3_capabilities "TOP" "USER";

#       # imap_capabilities "IMAP4rev1" "UIDPLUS";

#

#       server {

#               listen     localhost:110;

#               protocol   pop3;

#               proxy      on;

#       }

#

#       server {

#               listen     localhost:143;

#               protocol   imap;

#               proxy      on;

#       }

#}


0
0

Node.js项目线上服务器部署与发布

阿里云部署Node.js+MongoDB+Nginx的应用项目,打通全栈

1747 学习 · 448 问题

查看课程