在我的VPS上,我已将nginx设置为反向代理。我正在尝试配置nginx以连接到jenkins和docker容器。 来自/ etc / nginx / sites-enabled / default的配置文件:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name jarekslaby.pl;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
include snippets/self-signed.conf;
include snippets/ssl-params.conf;
access_log /var/log/nginx/jenkins.access.log;
error_log /var/log/nginx/jenkins.error.log;
location / {
include /etc/nginx/proxy_params;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
#proxy_pass http://172.17.0.5:8080;
proxy_pass http://localhost:8081;
#proxy_read_timeout 90s;
# Fix potential "It appears that your reverse proxy set up is broken" error.
}
location /portainer {
include /etc/nginx/proxy_params;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
proxy_pass http://172.17.0.2:9000;
}
}
问题是当我尝试连接到/ portainer时。 我唯一能看到的是404错误 - 找不到页面。任何想法这个配置有什么问题?
在同一台机器上我有防火墙允许仅在443和22(ssh)端口上发出请求。对/ location的所有请求都被重定向到jenkins。