more/etc/nginx/conf.d/default.conf
server {
listen 443 ssl;# managed by Certbot
ssl_certificate/etc/letsencrypt/live/ict-cloud.thupdi.com/fullchain.pem;# managed by Certbot
ssl_certificate_key/etc/letsencrypt/live/ict-cloud.thupdi.com/privkey.pem;# managed by Certbot
include/etc/letsencrypt/options-ssl-nginx.conf;# managed by Certbot
ssl_dhparam/etc/letsencrypt/ssl-dhparams.pem;# managed by Certbot
server_name AA.BB.com;
charset utf-8;
client_max_body_size 500m;
# tomcat 81端口
location / {
proxy_pass http://127.0.0.1:81/;
}
location/v2/{
proxy_pass http://IP:81/;
}
# 由于81端口下有应用是以thcloud开头的,所以这个地方需要使用正则表达式匹配
location/thcloud/{
proxy_pass http://127.0.0.1:8081/thcloud/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection"Upgrade";
proxy_read_timeout 5m;
}
location/new/thcloud/{
proxy_pass http://172.30.11.155:8081/thcloud/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection"upgrade,keep-alive";
tcp_nodelay on;
proxy_http_version 1.1;
proxy_buffering off;
proxy_request_buffering off;
proxy_set_header X-Accel-Buffering no;
proxy_max_temp_file_size 0;
}
location/sjzl/{
proxy_pass http://IP:9090/sjzl/;
}
location/geoserver/{
proxy_pass http://IP:8080/geoserver/;
}
location/jupyter{
proxy_pass http://IP:8000/;
}
location/hub{
proxy_pass http://IP:8000/hub/;
}
location/user/jupyteradmin{
proxy_pass http://IP:8000/user/jupyteradmin;
}
location/user/jupyterhub{
proxy_pass http://IP:8000/user/jupyterhub;
}
#0218
#这个/jupyterhub/与上面添加的对应
location/jupyterhub/{
proxy_pass http://IP:8000/jupyterhub/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection"upgrade";
#这是代理网站的资源,可以查看但不能下载
add_header Content-Disposition"inline";
add_header X-Content-Type-Options"nosniff";
}
# proxy_http_version 1.1显然意思是指定http版本为1.1, 如果不加的话, 在Notebook中将无法连接到内核, 一直会显示disconnected.
#这个是资源禁止访问且禁止下载
location ~ \.(zip|rar|sql|bak|gz|7z|py|pdf|doc|docx|xls|xlsx|out)$ {
add_header Content-Disposition"inline";
add_header X-Content-Type-Options"nosniff";
# return 404;
}
#浏览器禁止下载
#location /jupyterhub/ {
location//{
#rewrite /jupyterhub/files/* /1111;
rewrite/jupyterhub/files/*/404permanent;
#rewrite /jupyterhub/files/(.*)$ /404;
proxy_pass http://IP:8000/jupyterhub/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection"upgrade";
add_header Content-Disposition"inline";
# add_header X-Content-Type-Options "nosniff";
add_header X-Content-Type-Options"nosniff";
}
location ~ ^/.well-known/acme-challenge{
allow all;
root/var/www/html;
try_files $uri = 404;
break;
}
location/arcgis/{
proxy_pass http://127.0.0.1:6080;
proxy_redirect off;
}
# arcgis服务 重定向 (IP访问转域名访问)
location/arcgis/rest/services/{
proxy_pass http://127.0.0.1:6080/arcgis/rest/services/;
}
error_page 500 502 503 504/50x.html;
location =/50x.html {
root/usr/share/nginx/html;
}
}
server {
listen 80;
server_name AA.BB.com;
location / {
return301 https://$host$request_uri;
}
if($host = ict-cloud.thupdi.com) {
return301 https://$host$request_uri;
}
}
|