此处共有nginx noob。我已经浏览了互联网,我找到的所有说明和示例都是针对比我更复杂的用例。
我想做的事情:
代理http://BAREIP/guacamole/响应,好像http://BAREIP:8080/guacamole/在地址栏中,但是请求完全在端口80上发送到服务器。
背景:尝试为短期课程设置一些培训服务器,这些服务器将在一天结束时拆除。没有域名,不需要SSL或任何东西。需要能够为公司锁定网络上的学生公开课程的RDP接口,这样他们只能(确定地)端口80和443对互联网开放。我把guacamole部分完美地设置好并且在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。当我去http://BAREIP/时,我得到了通用" nginx在"页。当我去http://BAREIP:8080/guacamole/时,我得到了鳄梨酱登录页面,当我去http://BAREIP:8080/时,我得到了通用的#34; tomcat已经开启了#34;页。
我缺少哪一步才能使代理工作?
感谢。
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"
答案 0 :(得分:0)
你错过了listen 80
;在服务器块中