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
    • 最新
    • 标签
主页 / server / 问题

问题[socket](server)

Martin Hope
Sam
Asked: 2021-08-14 01:04:27 +0800 CST

Mysqli访问被拒绝,使用UNIX套接字[重复]

  • 0
这个问题在这里已经有了答案:
启用对 MySQL 的无密码访问 6 个答案
去年关闭。

我正在尝试学习 PHP,并且正在设置数据库连接。
在 Mysql Workbench 上,我创建了一个名为 php 的数据库,并创建了一个表。然后我使用 auth_socket 创建了帐户“sam”@“localhost”,(我使用的是 Ubuntu 桌面,并且sam是 的输出whoami),Granted ALL on 。,当我按ctrl+alt+T输入mysql并按时enter,我可以成功登录。
现在我跟着https://www.php.net/manual/en/mysqli.quickstart.connections.php,并尝试使用套接字,我失败了。

2021/08/13 16:54:35 [error] 1363#1363: *11 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli::__construct(): (HY000/1698): Access denied for user 'sam'@'localhost' in /var/www/php/my2.php on line 3PHP message: PHP Warning:  main(): Couldn't fetch mysqli in /var/www/php/my2.php on line 5" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /my2.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "localhost:803"

这是我的代码。<?php

$mysqli = new mysqli("localhost", "sam", Null, "php");

echo $mysqli->host_info . "\n";

输出在浏览器中什么都没有。

然后我尝试了这个。

<html>
   <head>
      <title>Connecting MySQL Server</title>
   </head>
   <body>
      <?php
         $dbhost = 'localhost';
         $dbuser = 'sam';
         //$dbpass = 'root@123';
         $mysqli = new mysqli($dbhost, $dbuser,NULL,NULL,NULL,"/run/mysqld/mysqld.sock");
         
         if($mysqli->connect_errno ) {
            printf("Connect failed: %s<br />", $mysqli->connect_error);
            exit();
         }
         printf('Connected successfully.<br />');
         $mysqli->close();
      ?>
   </body>
</html>

输出是 Connect failed: Access denied for user 'sam'@'localhost'
带日志

2021/08/13 16:59:17 [error] 1363#1363: *13 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli::__construct(): (HY000/1698): Access denied for user 'sam'@'localhost' in /var/www/php/mysqli.php on line 10" while reading response header from upstream, client: 127.0.0.1, server: _, request: "GET /mysqli.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "localhost:803"

我没有sammysql用户的密码。

MariaDB [mysql]> select user,password from user;
+-----------+-------------------------------------------+
| user      | password                                  |
+-----------+-------------------------------------------+
| root      |                                           |
| someone   | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| someone   | *9B8A3238012965AC630589D859535EA0B7C231A7 |
| someone   | *AF411B6C73B3AC3A2316A309A71758175CC14FEE |
| someone   | *D76A454D84260E84578F09915624F275F3D0E08B |
| sam       |                                           |
+-----------+-------------------------------------------+
6 rows in set (0.001 sec)

我将实际用户名更改为某人以保护隐私。你可以看到sam没有密码。

mysql php socket
  • 1 个回答
  • 301 Views
Martin Hope
hyogy
Asked: 2021-07-27 12:55:25 +0800 CST

Socat - 有可能吗?

  • 1

在使用 socat 进行端口转发时,有什么方法可以监听和执行命令(对于每个连接)?一个不工作的例子使它更清楚:

socat TCP-LISTEN:8080,reuseaddr, "exec:ls" fork tcp:localhost:80

linux port-forwarding socket socat
  • 1 个回答
  • 1476 Views
Martin Hope
Bemipefe
Asked: 2021-05-23 09:39:20 +0800 CST

ssh 端口转发,在远程和目标之间具有永久连接

  • 1

我知道您可以使用 ssh 将本地或远程端口转发到另一个目的地和端口。例如,假设我有这个命令:

ssh -L *:8443:10.0.0.1:443 user@10.0.0.2

因此,这允许在发出命令的机器上打开一个监听套接字(假设它的 ip 是10.0.0.3)在 port 上8443。当一些客户端连接到数据包时10.0.0.3:8443,数据包流通过它们之间建立的 ssh 通道10.0.0.3,10.0.0.2然后 ssh 服务器10.0.0.2将数据包转发到目的地,在这种情况下为 10.0.0.1:443。

我想知道服务器是否10.0.0.2可以建立永久连接,10.0.0.1:443以便连接10.0.0.2:xxxxx -> 10.0.0.1:443打开一次并且永远不会断开。来自连接到的客户端的所有流量10.0.0.3:8443都应使用此永久通道。

所以基本上我不希望在建立新客户端连接到10.0.0.3:8443新通道时出现这种10.0.0.2:xxxxx -> 10.0.0.1:443情况。这可以防止我重用同一个会话并使另一个客户端在第一个客户端之后发送的请求无效。

ssh port-forwarding ssh-tunnel socket
  • 1 个回答
  • 229 Views
Martin Hope
Cenkoloji
Asked: 2021-04-28 15:19:42 +0800 CST

Python 套接字:Linux 中的 TCP 错误,而相同的程序在 Windows10 上运行良好

  • -1

我正在尝试使用 python 套接字通过 TCP/IP 与商用电源设备进行通信。

我尝试在同一网络接口上同时使用虚拟 linux(centos8stream)和虚拟 windows10,它们都在同一台物理计算机上运行。两者都有python3.9。

我想象 tcp/ip 套接字在两个操作系统中都可以正常工作,但我只在 linux 中遇到了一些通信问题:

  • 几次尝试后,发送和接收之间的延迟变得更长(2 秒而不是 0.14 秒)
  • 有时我会超时,根本无法与设备通信。

我让 Wireshark 在两个操作系统中运行:

  • 在 Windows 中没有异常消息(很少有 TCP 重传)
  • 在 linux 中,一段时间后(或有时立即)wireshark 会被 TCP Dup Ack、TCP Fast Retransmission 和 TCP Spurious Retransmissions 淹没。

我的问题:

  1. 差异的根源可能是什么?我可以尝试任何套接字选项吗?
  2. 有没有办法比较linux和windows10中的网络参数?

连续读取设备标识的示例程序:

import socket
from time import sleep,time
HOST = '10.27.4.50'
PORT = 4444

#Create object and open the connection
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((HOST, PORT))

client.settimeout(5)

# Read identification
message=(b'*IDN?\r\n')

for i in range(5):
    start_time = time()
    client.sendall(message)
    rep=client.recv(1024)
    print("Trial {}, delay: {} seconds ".format(i,time() - start_time))
    sleep(1)

client.close()

视窗:

Trial 0, delay: 0.17121100425720215 seconds
Trial 1, delay: 0.10957813262939453 seconds
Trial 2, delay: 0.17148327827453613 seconds
Trial 3, delay: 0.13976049423217773 seconds
Trial 4, delay: 0.14109373092651367 seconds

linux(看到最后一条消息需要更长的时间才能收到响应,这对应于 TCP 错误的开始)

Trial 0, delay: 0.15080499649 seconds
Trial 1, delay: 0.143104076385 seconds
Trial 2, delay: 0.170531988144 seconds
Trial 3, delay: 0.183187961578 seconds
Trial 4, delay: 2.0480530262 seconds

注意:我还尝试了一台物理 linux 机器,也有同样的问题。

python tcpip wireshark socket
  • 1 个回答
  • 457 Views
Martin Hope
mirzaD14
Asked: 2021-04-26 07:10:29 +0800 CST

如何在 EC2 实例上打开套接字?

  • 1

我想将网络摄像头视频从我的笔记本电脑发送到 aws EC2 实例。

我正在尝试遵循此处的建议和此处的代码。

我面临的问题是我不知道如何打开套接字并监听 EC2 上的传入流量。我的 EC2 是一个 Amazon Linux 免费套餐实例。无论我尝试什么,我都无法让它工作。

我添加了一个入站规则以允许我想监听的端口上的 TCP 流量。

如果有帮助,绑定到端口似乎不是问题,但似乎代码卡在socket.accept()链接 2 的代码行上。

如果有人向我展示如何正确执行此操作,我将不胜感激。

amazon-ec2 socket amazon-web-services websocket
  • 2 个回答
  • 1865 Views
Martin Hope
G M
Asked: 2021-04-02 08:46:57 +0800 CST

使用 gunicorn 和 Nginx 服务多个套接字会导致 NotFound 错误

  • 0

我正在尝试使用 Nginx 作为反向代理来提供两个 Flask 应用程序。在我default.conf 重新加载的sudo service nginx restart我有:

    location /app2loc/ {
            include proxy_params;
            proxy_pass http://unix:/var/www/html/app2/app.sock;
    }
    location / {
            include proxy_params;
            proxy_pass http://unix:/var/www/html/app1/app.sock;
    }

当app1我在www.mydomain.com. 第二个应用程序app2似乎运行有任何错误作为证据,这是输出sudo systemctl status app2.service:

● app2.service - Gunicorn instance to serve Flask app2.
   Loaded: loaded (/etc/systemd/system/capitcatalog.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-04-01 18:11:28 CEST; 26min ago
 Main PID: 24762 (gunicorn)
    Tasks: 25 (limit: 4423)
   CGroup: /system.slice/capitcatalog.service
           ├─24762 /var/www/html/app2/env/bin/python3.6 /var/www/html/app2/env/bin/gunicorn --chdir /var/www/html/app2/ -w 3 -b unix:app.sock -m 007 
           ├─24778 /var/www/html/app2/env/bin/python3.6 /var/www/html/app2/env/bin/gunicorn --chdir /var/www/html/app2/ -w 3 -b unix:app.sock -m 007 
           ├─24779 /var/www/html/app2/env/bin/python3.6 /var/www/html/app2/env/bin/gunicorn --chdir /var/www/html/app2/ -w 3 -b unix:app.sock -m 007 
           └─24780 /var/www/html/app2/env/bin/python3.6 /var/www/html/app2/env/bin/gunicorn --chdir /var/www/html/app2/ -w 3 -b unix:app.sock -m 007

但是,当我尝试使用它访问它时,www.mydomain.com/app2loc我有一个

Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

我想知道可能是什么错误。为什么第二个套接字似乎无法访问?

这是的输出nginx -T:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

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_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/*;

    # ADDED FOR UV VIEWR
    proxy_cache_key $scheme$proxy_host$uri;
    fastcgi_cache_key "$scheme$host$uri";


}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

# configuration file /etc/nginx/modules-enabled/50-mod-http-geoip.conf:
load_module modules/ngx_http_geoip_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-http-image-filter.conf:
load_module modules/ngx_http_image_filter_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-http-xslt-filter.conf:
load_module modules/ngx_http_xslt_filter_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-mail.conf:
load_module modules/ngx_mail_module.so;

# configuration file /etc/nginx/modules-enabled/50-mod-stream.conf:
load_module modules/ngx_stream_module.so;

# configuration file /etc/nginx/mime.types:

types {
    text/html                             html htm shtml;
    text/css                              css;
    text/xml                              xml;
    image/gif                             gif;
    image/jpeg                            jpeg jpg;
    application/javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;

    text/mathml                           mml;
    text/plain                            txt;
    text/vnd.sun.j2me.app-descriptor      jad;
    text/vnd.wap.wml                      wml;
    text/x-component                      htc;

    image/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;

    application/font-woff                 woff;
    application/java-archive              jar war ear;
    application/json                      json;
    application/mac-binhex40              hqx;
    application/msword                    doc;
    application/pdf                       pdf;
    application/postscript                ps eps ai;
    application/rtf                       rtf;
    application/vnd.apple.mpegurl         m3u8;
    application/vnd.ms-excel              xls;
    application/vnd.ms-fontobject         eot;
    application/vnd.ms-powerpoint         ppt;
    application/vnd.wap.wmlc              wmlc;
    application/vnd.google-earth.kml+xml  kml;
    application/vnd.google-earth.kmz      kmz;
    application/x-7z-compressed           7z;
    application/x-cocoa                   cco;
    application/x-java-archive-diff       jardiff;
    application/x-java-jnlp-file          jnlp;
    application/x-makeself                run;
    application/x-perl                    pl pm;
    application/x-pilot                   prc pdb;
    application/x-rar-compressed          rar;
    application/x-redhat-package-manager  rpm;
    application/x-sea                     sea;
    application/x-shockwave-flash         swf;
    application/x-stuffit                 sit;
    application/x-tcl                     tcl tk;
    application/x-x509-ca-cert            der pem crt;
    application/x-xpinstall               xpi;
    application/xhtml+xml                 xhtml;
    application/xspf+xml                  xspf;
    application/zip                       zip;

    application/octet-stream              bin exe dll;
    application/octet-stream              deb;
    application/octet-stream              dmg;
    application/octet-stream              iso img;
    application/octet-stream              msi msp msm;

    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;

    audio/midi                            mid midi kar;
    audio/mpeg                            mp3;
    audio/ogg                             ogg;
    audio/x-m4a                           m4a;
    audio/x-realaudio                     ra;

    video/3gpp                            3gpp 3gp;
    video/mp2t                            ts;
    video/mp4                             mp4;
    video/mpeg                            mpeg mpg;
    video/quicktime                       mov;
    video/webm                            webm;
    video/x-flv                           flv;
    video/x-m4v                           m4v;
    video/x-mng                           mng;
    video/x-ms-asf                        asx asf;
    video/x-ms-wmv                        wmv;
    video/x-msvideo                       avi;
}

# configuration file /etc/nginx/conf.d/default.conf:

server {
        server_name www.mydomain.com;
        listen 80;
        root /var/www/html/;

    # this is working properly 
    location /vrt/ {
            alias /var/www/html/vrt/; 
        }

    location /app2/ {
                include proxy_params;
                proxy_pass http://unix:/var/www/html/app2/app.sock;
        }

}        

# configuration file /etc/nginx/proxy_params:
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
nginx socket gunicorn flask
  • 1 个回答
  • 205 Views
Martin Hope
WiringHarness
Asked: 2021-03-13 17:45:35 +0800 CST

如何更改 docker.socket 组

  • 1

我正在一个最受信任的网络中管理多个运行 Ubuntu 18.04(带有 systemd)和 Docker 的计算主机。

我有一个身份验证服务器,因此我没有手动将用户添加到 docker 组,以便他们可以运行 docker 命令,而是在身份验证服务器上创建了一个组 ldap-docker 并将我的用户添加到其中。然后我将 "group": "ldap-docker" 添加到 /etc/docker/daemon.json 文件中,并从系统中删除了本地 "docker" 组。

这在几个主机上都可以正常工作,但在其中一些主机上 docker.service 不会启动,因为 /var/run/docker.sock 仍然由 root:root 拥有,而不是 root:ldap-docker。docker.socket.service 也报告启动失败

$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
$ sudo systemctl status docker.socket
● docker.socket - Docker Socket for the API
   Loaded: loaded (/lib/systemd/system/docker.socket; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2021-03-12 08:11:48 PST; 8h ago
   Listen: /var/run/docker.sock (Stream)

Mar 12 08:11:48 host.example.com systemd[1]: Starting Docker Socket for the API.
Mar 12 08:11:48 host.example.com systemd[1171]: docker.socket: Failed to resolve group docker: Connection refused
Mar 12 08:11:48 host.example.com systemd[1]: docker.socket: Control process exited, code=exited status=216
Mar 12 08:11:48 host.example.com systemd[1]: docker.socket: Failed with result 'exit-code'.
Mar 12 08:11:48 host.example.com systemd[1]: Failed to listen on Docker Socket for the API.

我可以在 /var/run/docker.sock 套接字上运行 sudo chgrp,但是 docker 服务已经无法启动,所以这无济于事。

如何控制 docker.sock.service 的启动?为什么我的设置在某些机器上可以正常工作,而在其他机器上不行?

socket docker systemd ubuntu-18.04
  • 1 个回答
  • 2057 Views
Martin Hope
Codejoy
Asked: 2021-03-12 11:17:30 +0800 CST

简单的 systemd 服务和套接字失败

  • 0

我有一个服务,我试图以这种方式运行,但它是一个稍微大一点的 python 程序。我退后一步,构建了一个简单的 Python 程序,看看我是否可以让它运行。当我尝试通过 telnet 连接到正在运行的此套接字时,它失败了。下面是 .socket、.service 和 .py 文件....

testPy.socket

[Unit]
Description=Socket to TESTPY for connection
PartOf=testPy.service

[Socket]
ListenStream=30001

[Install]
WantedBy=sockets.target

testPy.service

[Unit]
Description=TEST PY
After=network.target testPy.socket
Requires=testPy.socket
[Service]
ExecStart=/home/workers/miniconda2/bin/python /home/workers/testPy.py
StandardInput=socket
[Install]
WantedBy=default.target

testPy.py

import sys

END_OF_LINE = '\r\n'
while(1):
        input = sys.stdin.readline()
        buffer = input.strip()
        if not buffer:
                sys.stdout.write("OKAY DUDE")
                sys.stdout.flush()
                continue
        if buffer in ['quit', 'QUIT']:
                break
        sys.stdout.write('\n' + buffer + END_OF_LINE)
        sys.stdout.flush()

现在,如果我在命令行中运行它,它运行良好。我可以输入退出,它退出循环,回声任何东西..

如果我说:

systemctl start testPy.socket

然后输入:

远程登录本地主机 30001

它连接一点然后放下它。然后各种状态(对我来说)是非描述性的:

systemctl status testPy.socket

● testPy.socket - Socket to TESTPY for connection
   Loaded: loaded (/etc/systemd/system/testPy.socket; disabled; vendor preset: disabled)
   Active: failed (Result: service-failed-permanent) since Thu 2021-03-11 13:59:54 EST; 11min ago
   Listen: [::]:30001 (Stream)

Mar 11 13:59:42 dhcp-093.apo.nmsu.edu systemd[1]: Listening on Socket to TESTPY for connection.
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: Unit testPy.socket entered failed state.

systemctl status testPy.service

● testPy.service - TEST PY
   Loaded: loaded (/etc/systemd/system/testPy.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Thu 2021-03-11 13:59:54 EST; 12min ago
  Process: 2087 ExecStart=/home/workers/miniconda2/bin/python /home/workers/testPy.py (code=exited, status=1/FAILURE)
 Main PID: 2087 (code=exited, status=1/FAILURE)

Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: Started TEST PY.
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: testPy.service: main process exited, code=exited, status=1/FAILURE
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: Unit testPy.service entered failed state.
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: testPy.service failed.
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: start request repeated too quickly for testPy.service
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: Failed to start TEST PY.
Mar 11 13:59:54 dhcp-093.apo.nmsu.edu systemd[1]: testPy.service failed.

我相信如果我可以让这个简单的测试工作,我可以获得我需要运行的更大的 .py 文件,因为它的工作原理基本相同。我为此构建了一个服务和套接字,通常有相同的错误。虽然systemctl status kosmos.service给出了一个失败的仍然但是说主PID状态= 0/成功所以这很奇怪。

它说启动限制是失败的,但是如果像这里这样简单的服务必须启动并启动并启动这意味着其他错误,猜测我的套接字或服务文件中的配置但不确定是什么。我希望我的 python 不会因监听 sys.stdin.readline 等而改变,而它读取的行只是来自另一台机器在该端口(30001)上建立的连接。我认为这就是所有这些套接字的作用(所有这些都是因为它曾经在带有 xinetd 的旧机器上运行)

socket systemd systemctl
  • 1 个回答
  • 704 Views
Martin Hope
user2009388
Asked: 2020-11-28 08:16:05 +0800 CST

停用 systemd 套接字激活的默认端口

  • 0

我有一个在 CentOS 8.2 上运行的 Apache 服务器,其套接字由 systemd 套接字激活管理。但我不希望它在默认端口 80 上进行监听,因为我想在此端口上使用 Nginx 运行反向代理。这是当前的 systemd 套接字配置:

root@server6:~# systemctl status httpd.socket
● httpd.socket - Apache httpd Server Socket
   Loaded: loaded (/usr/lib/systemd/system/httpd.socket; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/httpd.socket.d
           └─20-redir8016.conf, 30-listen8017ssl.conf, override.conf
   Active: active (running) since Fri 2020-11-20 14:45:13 UTC; 1 weeks 0 days ago
     Docs: man:httpd.socket(8)
   Listen: [::]:80 (Stream)
           [::]:8001 (Stream)
           [::]:8002 (Stream)
           [::]:8003 (Stream)
    Tasks: 0 (limit: 820374)
   Memory: 0B
   CGroup: /system.slice/httpd.socket

如您所见,端口 80 已启用。这是默认设置。其他端口是故意添加的。的手册页httpd.socket(8)仅描述如何添加另一个端口,而不是如何删除默认端口。.80 端口没有在任何配置文件中配置/etc/httpd。

如何在此处停用端口 80?默认配置存储在哪里?

socket apache-2.4 systemd centos8
  • 1 个回答
  • 625 Views
Martin Hope
milosgajdos
Asked: 2020-11-19 02:51:42 +0800 CST

BBR 拥塞控制在我的主机上是否可用

  • 0

我一直在研究在我们的一些服务器上启用bbr 拥塞控制,以测试它们是否对我们的工作负载有任何影响。

我们在 Amazon Linux 2 上:

# uname -a
Linux ip-10-1-66-180.us-east-1.aws.dckr.io 4.14.173-137.229.amzn2.x86_64 #1 SMP Wed Apr 1 18:06:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

我查看了可用的拥塞控制并得到了这个

# cat /proc/sys/net/ipv4/tcp_available_congestion_control
cubic reno

这是否意味着bbr我们的内核中不提供支持?我看到有些人显示上述命令的相同输出,但仍然将sysctls 设置为bbr不管。

我还检查了内核模块,因为我在某处读到bbr需要加载某些模块,但我怀疑这对于旧内核是必要的。

# lsmod | grep -i bbr

bbr鉴于我之前提到的内核版本,有没有一种方法可以在我们的服务器上启用?

linux-kernel socket linux-networking
  • 1 个回答
  • 287 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