1

总 nginx 菜鸟在这里。我已经搜索了互联网,我发现的所有说明和示例都适用于比我拥有的更复杂的用例。

我正在尝试做的事情:

代理http://BAREIP/guacamole/响应,就好像http://BAREIP:8080/guacamole/在地址栏中一样,但是请求完全通过端口 80 发送到服务器。

背景:尝试搭建一些短期课程的培训服务器,最终会被拆除。没有域,不需要 SSL 或任何东西。需要能够为处于公司锁定网络上的学生公开一个 RDP 接口,以便他们只有(肯定)端口 80 和 443 对互联网开放。我已经完美地设置了鳄梨酱部分,并且在 8080 上运行良好。但我们不能确定 8080 是否打开,所以我们想使用端口 80。(对于 MySQL 身份验证的这个用例来说,这太棒了)但我正在努力解决nginx 部分。我没有做过任何 AJP 的东西。

我的 nginx.conf 文件如下所示:

user www-data;
worker_processes auto;
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;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # 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/javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

        server{
                location /guacamole/ {
                    proxy_pass http://localhost:8080/guacamole/;
                    proxy_buffering off;
                    proxy_http_version 1.1;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection $http_connection;
                    proxy_cookie_path /guacamole/ /;
                    access_log off;
                }
        }
}

发生了什么:

当我去http://BAREIP/guacamole/时,我得到 404 not found。当我去http://BAREIP/时,我得到了通用的“nginx is on”页面。当我转到http://BAREIP:8080/guacamole/时,我得到了 guacamole 登录页面,当我转到http://BAREIP:8080/时,我得到了通用的“tomcat 已开启”页面。

我缺少什么步骤来使这个代理工作?

谢谢。

access.log 除外:

MY_IP - - [05/Feb/2017:03:08:33 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
MY_IP - - [05/Feb/2017:03:08:50 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
MY_IP - - [05/Feb/2017:03:08:54 +0000] "GET /guacamole HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
MY_IP - - [05/Feb/2017:03:08:57 +0000] "GET /guacamole/ HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"
4

1 回答 1

0

你不见了listen 80;在服务器块中

于 2017-02-05T02:38:51.697 回答