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-439512

Philip Rego's questions

Martin Hope
Philip Rego
Asked: 2021-10-18 14:18:41 +0800 CST

为什么是我的上游本地主机?在 Nginx 中获得 500 但没有应用程序错误。“连接到上游时没有实时上游”

  • 0

我正在按照本教程使用 Nginx 在 CentOS 上托管一个 React 应用程序。该网站在我运行时有效(200 响应)curl localhost:3000,但是当我尝试访问他的anthurie.com时,我收到 500 错误,并且此错误在/var/log/nginx/error.log

2021/10/17 17:56:16 [error] 5379#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.1, server: anthurie.com, request: "GET / HTTP/1.1", upstream: "https://[::1]:3000/", host: "anthurie.com"
2021/10/17 17:56:16 [error] 5379#0: *5 SSL_do_handshake() failed (SSL: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol) while SSL handshaking to upstream, client: 192.168.1.1, server: anthurie.com, request: "GET / HTTP/1.1", upstream: "https://127.0.0.1:3000/", host: "anthurie.com"
2021/10/17 17:56:17 [error] 5379#0: *5 no live upstreams while connecting to upstream, client: 192.168.1.1, server: anthurie.com, request: "GET /favicon.ico HTTP/1.1", upstream: "https://localhost/favicon.ico", host: "anthurie.com", referrer: "https://anthurie.com/"
2021/10/17 18:01:01 [error] 5379#0: *9 no live upstreams while connecting to upstream, client: 192.168.1.1, server: anthurie.com, request: "GET / HTTP/1.1", upstream: "https://localhost/", host: "anthurie.com"
2021/10/17 18:01:02 [error] 5379#0: *9 no live upstreams while connecting to upstream, client: 192.168.1.1, server: anthurie.com, request: "GET /favicon.ico HTTP/1.1", upstream: "https://localhost/favicon.ico", host: "anthurie.com", referrer: "https://anthurie.com/"

不知道为什么upstream: "https://localhost/"应用程序大部分时间都在localhost:3000

/etc/systemd/system/anthurie.service

[Unit]
Description=Service run for reactjs application anthurie.com
After=network.target

[Service]
Type=simple
User=prego
Group=nginx
StandardOutput=syslog
StandardError=syslog
WorkingDirectory=/var/metaplex/js
Environment=NODE_ENV=’production’
ExecStart=/usr/bin/yarn start
Restart=always

[Install]
WantedBy=multi-user.target

nginx.conf

    server {
        proxy_read_timeout 10m;
        server_name anthurie.com;

        #a special location in case don't cache this file can be deleted
        location updater/serversettings.xml {
          expires -1;
          add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
        }

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        #The root/rest will be redirected
        location / {
            proxy_cache             hd_cache;
            proxy_set_header        X-Cache-Status $upstream_cache_status;
            proxy_cache_valid       200 1w;
            proxy_pass              https://localhost:3000;
            proxy_set_header        Host $http_host;
            proxy_buffers           16 8m;
            proxy_buffer_size       2m;
            gzip                    on;
            gzip_vary               on;
            gzip_comp_level         9;
            gzip_proxied            any;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }


        listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/anthurie.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/anthurie.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

}
                                                                                                                                                                                    

我正在这台服务器上运行一个具有类似 nginx 配置的 Java 网站。不知道为什么当应用程序似乎运行良好时我会得到 500。

$ sudo systemctl status anthurie
● anthurie.service - Service run for reactjs application anthurie.com
   Loaded: loaded (/etc/systemd/system/anthurie.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-10-17 17:26:48 EDT; 49min ago
 Main PID: 4908 (node)
   CGroup: /system.slice/anthurie.service
           ├─4908 node /usr/share/yarn/bin/yarn.js start
           ├─4929 /usr/bin/node /var/metaplex/js/node_modules/.bin/cross-env CI=true lerna run start --scope @oyster/common --stream --parallel --scope web
           ├─4936 /usr/bin/node /var/metaplex/js/node_modules/.bin/lerna run start --scope @oyster/common --stream --parallel --scope web
           ├─4950 node /usr/share/yarn/bin/yarn.js run start
           ├─4961 node /usr/share/yarn/bin/yarn.js run start
           ├─4992 /usr/bin/node /var/metaplex/js/node_modules/.bin/npm-run-all --parallel watch watch-css watch-css-src
           ├─5010 /usr/bin/node /var/metaplex/js/packages/web/node_modules/.bin/next dev
           ├─5016 /usr/bin/node /usr/share/yarn/bin/yarn.js run watch
           ├─5017 /usr/bin/node /usr/share/yarn/bin/yarn.js run watch-css
           ├─5023 /usr/bin/node /usr/share/yarn/bin/yarn.js run watch-css-src
           ├─5061 /usr/bin/node /var/metaplex/js/node_modules/.bin/tsc --watch
           ├─5071 /usr/bin/node /home/prego/.yarn/bin/less-watch-compiler src/ src/
           ├─5079 /usr/bin/node /home/prego/.yarn/bin/less-watch-compiler src/ dist/lib/
           └─5255 /usr/bin/node /var/metaplex/js/node_modules/next/node_modules/jest-worker/build/workers/processChild.js

Oct 17 17:27:12 localhost.localdomain yarn[4908]: @oyster/common:         Property 'Bitpie' is missing in type 'import("/var/metaplex/js/node_modules/@solana/wallet-adapter-react/node_mo....WalletName'.
Oct 17 17:27:12 localhost.localdomain yarn[4908]: @oyster/common: src/contexts/wallet.tsx(230,3): error TS2344: Type '"publicKey" | "signTransaction" | "signAllTransactions"' does not sa...vents, any>'.
Oct 17 17:27:12 localhost.localdomain yarn[4908]: @oyster/common:   Type '"signTransaction"' is not assignable to type 'keyof WalletAdapterProps | keyof EventEmitter<WalletAdapterEvents, any>'.
Oct 17 17:27:12 localhost.localdomain yarn[4908]: @oyster/common: src/contracts/token.ts(106,23): error TS2571: Object is of type 'unknown'.
Oct 17 17:27:12 localhost.localdomain yarn[4908]: @oyster/common: 5:27:12 PM - Found 7 errors. Watching for file changes.
Oct 17 17:27:56 localhost.localdomain yarn[4908]: web: event - build page: /
Oct 17 17:27:56 localhost.localdomain yarn[4908]: web: wait  - compiling...
Oct 17 17:28:02 localhost.localdomain yarn[4908]: web: event - compiled successfully
Oct 17 17:29:04 localhost.localdomain yarn[4908]: web: wait  - compiling...
Oct 17 17:29:04 localhost.localdomain yarn[4908]: web: event - compiled successfully
nginx centos7
  • 1 个回答
  • 852 Views
Martin Hope
Philip Rego
Asked: 2019-08-12 22:05:21 +0800 CST

如何修复 catalina.out 中的错误“libjli.so:无法打开共享对象文件:没有这样的文件或目录”

  • 0

systemctl restart tomcat在我的$CATALINA_HOME/logs/catalina.out日志文件 中运行时出现此错误: https ://pastebin.com/Cpfs9xCk

所以我在网上关注了这篇文章: https ://confluence.atlassian.com/confkb/permission-denied-error-when-binding-a-port-290750651.html

  1. 如果使用 Linux 2.6.24 或更高版本,您可以在 java 可执行文件上设置文件功能,以授予提升权限以仅允许打开特权端口,而不允许打开其他超级用户权限:

setcap cap_net_bind_service+ep /path/to/bin/java 设置后你可能会在像这样启动 Java 时注意到错误,例如:

$ java -version /path/to/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory 这意味着库是从动态路径导入的,而不是在受信任的 ld.so 路径。有关详细信息,请参阅 http://bugs.sun.com/view_bug.do?bug_id=7157699。要解决此问题,您需要找到该库,并将其路径添加到 ld.so 配置。请注意,下面是一个示例,这可能因 Linux 发行版而异。将 JAVA_HOME 替换为正确的位置:

$ find JAVA_HOME -name 'libjli.so' JAVA_HOME/lib/amd64/jli/libjli.so
echo "JAVA_HOME/lib/amd64/jli" > /etc/ld.so.conf.d/java-libjli.conf ldconfig - v 设置完这一切后,您需要确保 Confluence 仅使用直接二进制路径启动 java,而不是通过符号链接,否则将无法获取该功能。

所以我运行了这个命令: setcap cap_net_bind_service+ep /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64

我得到了它所说的我可能会得到的东西:

 $CATALINA_HOME/logs/catalina.out 
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

我按照他们所说的进行了修复,但仍然无法正常工作,并且仍然出现上述错误:

$ find $JAVA_HOME -name 'libjli.so'
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/jli/libjli.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/lib/amd64/jli/libjli.so

出于某种原因,我有其中两个。我用路径创建了这个文件,但我仍然收到错误并且我的 tomcat 没有启动。

$ cat /etc/ld.so.conf.d/java-libjli.conf
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/amd64/jli
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/lib/amd64/jli
tomcat
  • 1 个回答
  • 2530 Views
Martin Hope
Philip Rego
Asked: 2019-08-11 11:14:53 +0800 CST

如何修复我的 systemctl 状态 tomcat?

  • 0

我怎样才能systemctl status tomcat返回“成功”而不是“失败”?

这是我的 etc/systemd/system/tomcat.service 文件:

    [Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JRE_HOME=JAVA_HOME='/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/'
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
#Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

现在,当我检查我的 tomcat 的状态时,它说

# systemctl status tomcat
● tomcat.service - Apache Tomcat Web Application Container
   Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2019-08-10 14:03:10 EDT; 55min ago
 Main PID: 22165 (code=exited, status=127)

Aug 10 14:03:10 localhost.localdomain kill[22167]: -q, --queue <sig>      use sigqueue(2) rather than kill(2)
Aug 10 14:03:10 localhost.localdomain kill[22167]: -p, --pid              print pids without signaling them
Aug 10 14:03:10 localhost.localdomain kill[22167]: -l, --list [=<signal>] list signal names, or convert one to a name
Aug 10 14:03:10 localhost.localdomain kill[22167]: -L, --table            list signal names and numbers
Aug 10 14:03:10 localhost.localdomain kill[22167]: -h, --help     display this help and exit
Aug 10 14:03:10 localhost.localdomain kill[22167]: -V, --version  output version information and exit
Aug 10 14:03:10 localhost.localdomain kill[22167]: For more details see kill(1).
Aug 10 14:03:10 localhost.localdomain systemd[1]: tomcat.service: control process exited, code=exited status=1
Aug 10 14:03:10 localhost.localdomain systemd[1]: Unit tomcat.service entered failed state.
Aug 10 14:03:10 localhost.localdomain systemd[1]: tomcat.service failed.



Caused by: java.net.ConnectException: Connection refused (Connection refused)

我在尝试运行 sudo certbot --apache 时遇到此错误

Error while running apachectl graceful.

Job for httpd.service invalid.

Unable to restart apache using ['apachectl', 'graceful']
Error while running apachectl restart.

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Encountered exception during recovery: 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/certbot/error_handler.py", line 124, in _call_registered
    self.funcs[-1]()
  File "/usr/lib/python2.7/site-packages/certbot/auth_handler.py", line 220, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 2332, in cleanup
    self.restart()
  File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 2202, in restart
    self._reload()
  File "/usr/lib/python2.7/site-packages/certbot_apache/configurator.py", line 2229, in _reload
    raise errors.MisconfigurationError(error)
MisconfigurationError: Error while running apachectl restart.

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

这是我的 journalctl -xe: https ://pastebin.com/JvJ8Uej0 这是我的 journalctl -b -u tomcat: https ://pastebin.com/zPqEBGXH

尝试杀死进程但没有工作:

# kill 23656
bash: kill: (23656) - No such process

在此处输入图像描述 这可能是什么原因?如何修复这些错误?该网站运行良好,但我收到了这些错误。

centos
  • 1 个回答
  • 29235 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