AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-403280

Vasil Koicev's questions

Martin Hope
Vasil Koicev
Asked: 2017-03-06 13:12:03 +0800 CST

tomcat 8 catalina.properties 添加变量

  • 2

我需要从 Tomcat 应用程序中读取一个环境变量。我试着做:

/opt/tomcat/conf/catalina.properties

最后添加:

my.special.variable=some_value

并通过阅读

System.getenv("my.special.variable")

我得到空

笔记

我在操作系统级别(linux ubuntu)定义了几个,但得到它们的结果是 tomcat root - /opt/tomcat。

例如 :

printenv我可以看到变量 HOME(也带有 echo $HOME)。从tomcat之外的程序运行代码 - 结果是正确的 - /home/user.

与部署在 tomcat 中的应用程序中的代码完全相同 - /opt/tomcat。

tomcat ubuntu environment-variables
  • 2 个回答
  • 19962 Views
Martin Hope
Vasil Koicev
Asked: 2017-03-05 07:59:05 +0800 CST

位置之间的 Nginx HTTP 代理链接

  • 1

假设我有一个域 test.com。Nginx 服务于多个应用程序。我能怎么做:

  • test.com/match/here - 这将是请求

由 nginx 处理为:

  • test.com/new/prefix/match/这里

nginx可以吗

#server context

location /match/here {
    proxy_pass http://example.com/new/prefix;
}
location /app {
    ...
}
. . .

另一个问题是一个位置如何仅通过 nginx 配置重新触发到另一个位置?

先感谢您!

proxy nginx
  • 1 个回答
  • 44 Views
Martin Hope
Vasil Koicev
Asked: 2017-03-03 04:02:51 +0800 CST

Nginx + Tomcat 8 + SSL 反向代理

  • 0

我正在关注这个例子:

https://devtidbits.com/2015/12/08/nginx-as-a-reverse-proxy-to-apache-tomcat/

我的目标是让 Tomcat 运行并在其前面运行 Nginx。

我想有类似这样的结构:

test.com/ - 来自 nginx 的静态站点

test.com/tomcat - tomcat 管理器(带有工作链接)

test.com/app - tomcat 应用程序(部署在 /app on tomcat)

app2.test.com/app

我的 Nginx 配置是:

upstream tomcat {
    server 127.0.0.1:8080 fail_timeout=0;
}
server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    include snippets/ssl-test.com.conf;
    include snippets/ssl-params.conf;
    root /var/www/test.com/html;
    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;
    server_name test.com www.test.com;
    location / {
        # First attempt to serve request as file, then as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }
    location ~ /.well-known {
                allow all;
        }

    location ~ ^/tomcat(/?)(.*)$ {  # OOPS!
      proxy_pass http://tomcat/$2$is_args$args;  # OOPS!
    }

    location /tomcat/ {
       include proxy_params;
       proxy_pass http://tomcat/;

        proxy_set_header HOST $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
  expires 1M;
 }
}

先感谢您!

ssl nginx reverse-proxy tomcat8
  • 1 个回答
  • 3824 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve