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 / 问题

问题[conf](server)

Martin Hope
vivek
Asked: 2021-07-24 20:27:20 +0800 CST

如果网络连接稍晚一点,ntpd 不会同步时钟

  • 0

在我们的生产环境中,我面临着 ntpd 的问题。我正在为我们的生产盒启用 NTP 功能并观察一个问题。

我们在盒子的初始化过程中启动 ntpd 守护进程。在那段时间互联网连接不存在。下面是我的小ntp.conf文件

driftfile  /etc/ntp.drift
logconfig =syncstatus
server pool.ntp.org iburst

一旦接口出现,我们的盒子就可以很晚地获得互联网连接。那个时候我看到 ntpd 没有同步时钟。当我这样做时ntpq -c as,我得到了no association id's found。我确实等了将近 30 分钟,但还是得到了no association id's found

我必须重新启动ntpd。重启后,ntpd 同步时钟,一切正常。但是,如果我重新启动我的盒子,那么同样的问题就会发生。再次,我必须重新启动 ntpd,一旦盒子出现并且可以访问互联网。

有没有人遇到过类似的问题?

我应该延迟 ntpd 的启动直到时间界面出现吗?

更新

我做了一些更多的实验,并用这个更改替换server pool.ntp.org iburst了pool pool.ntp.org iburstntpd 自动同步时钟。我不必重新启动 ntpd。所以这里对我提出了另一个问题。

当我替换为 时发生server了pool什么?

我应该总是使用pool关键字而不是server?

我应该什么时候使用pool,什么时候应该使用server?

我做了一些研究,发现 pool is the same as server, except it resolves one name into several addresses and uses them all 如果他们在做同样的事情,那为什么server pool.ntp.org iburst不为我工作但pool pool.ntp.org iburst工作。

更新

正如建议的那样,我已经使用pool了,server但我的时钟仍然无法在启动时同步。以前no association id's found来过,但在使用池后它正在显示列表。

GW:/admin# ntpq -c lpeer
     remote           refid      st t when poll reach   delay    offset  jitter
===================================================================== =========
 time.google.com .POOL.          16 p    -   64    0    0.000   +0.000   0.002

GW:/admin# ntpq -np
      remote           refid      st t when poll reach   delay   offset  jitter

 time.google.com .POOL.          16 p    -   64    0    0.000   +0.000   0.002

GW:/admin# ntpq -c as
ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1 34173  8811   yes  none  none    reject    mobilize  1

GW:/admin# ntpq -c "rv 34173"
associd=34173 status=8811 conf, bcast, sel_reject, 1 event, mobilize,
srcadr=0.0.0.0, srcport=0, srchost="time.google.com", dstadr=0.0.0.0,
dstport=0, leap=11, stratum=16, precision=-19, rootdelay=0.000,
rootdisp=0.000, refid=POOL, reftime=(no time), rec=(no time), reach=000,
unreach=0, hmode=3, pmode=0, hpoll=6, ppoll=10, headway=0,
flash=1400 peer_dist, peer_unreach, keyid=0, offset=+0.000, delay=0.000,
dispersion=16000.000, jitter=0.002,
filtdelay=     0.00    0.00    0.00    0.00    0.00    0.00      0.00    0.00,
filtoffset=   +0.00   +0.00   +0.00   +0.00   +0.00   +0.00   +0.00   +0.00,
filtdisp=   16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0

我看到闪存状态为1400。1400我无法1400在 ntp 文档中找到闪存状态是什么意思。

更新

它开始工作了。我替换iburst为minpoll 3 maxpoll 4,之后它正在重新启动。我用过这样的游泳池 pool pool.ntp.org minpoll 3 maxpoll 4。我不确定这种变化有什么不同。

我还读到我们应该避免使用 minpoll 和 maxpoll。 Too frequent for a sustained period and public NTP services may block you. ntpd is already good at dynamically selecting the pool interval.

不管怎样,谢谢大家帮助我。

ntp ntpd conf
  • 1 个回答
  • 289 Views
Martin Hope
MC-ifac
Asked: 2021-04-15 23:08:20 +0800 CST

获取子域的第一个字母作为变量

  • 0

如何在nginx中获取变量的第一个字母

例子

        server_name ~^(?<subdomain>\w+)\.development\.test$;

        location / {
                root /var/www/test/$subdomain.0/$subdomain;
                try_files $uri $uri/ =404;
        }

所以这可以 http://apple.development.test/ 走这条路 /var/www/test/a/apple

我见过使用地图的方法,但不确定如何正确执行此操作

subdomain nginx regex conf
  • 2 个回答
  • 113 Views
Martin Hope
user1828163
Asked: 2020-04-08 08:29:28 +0800 CST

我可以在 ntp 中同时使用池和服务器配置吗?

  • 0

对于 ntp 恶魔,如果我有这个配置会发生什么ntp.conf:

pool 0.pool.ntp.org burst iburst minpoll 4

server europe.pool.ntp.org

?

ntp 将如何配置?

我不知道有什么方法可以查询 ntp 的活动配置 - 以便知道哪个服务器或池,以及在给定时刻正在使用哪些选项。

ntp ntpd chrony conf
  • 2 个回答
  • 902 Views
Martin Hope
Veerendra K
Asked: 2017-02-13 04:34:36 +0800 CST

Apache 中用于 REST API 的 HTTPS 代理

  • 2

听起来像一个基本问题,但我不知道 apache 配置。任何帮助都会很棒。

由于Open TSDB 不支持 https 发送数据(通过 REST API),我们想在 apache 或“Apache Tomcat”中创建一个 https 代理。例如,本地机器同时具有 TSDB 和 Apahce。apache 应该接受 http 和 https,如果我发送任何到https://<PUBLIC IP>/api/input,它应该转发到TSDB同一台机器(或者TSDB可能在不同的机器上)http。

大图

MY Code<----> https://<PUBLIC IP>/api/input<----代理到---->http://localhost/api/input

上面我提到Apache Tomcat是因为,主要是我们将 Apache Tomcat 用于其他目的,所以,首要任务是 Tomcat(是否可以使用 Tomcat?)。

注意:Apache我知道和之间的区别Apache Tomcat:Apache 是 http Web 服务器只处理 http 流量,tomcat 是用于处理请求的 serverlet 容器(仅适用于 Java)。在构建Tomcat有Apache。(请纠正我,如果我错了)

tomcat apache-2.2 proxy conf
  • 3 个回答
  • 16020 Views
Martin Hope
Sherif
Asked: 2016-12-23 14:04:21 +0800 CST

Nginx 强制 https 仅用于索引页面

  • -2

设置 nginx conf 以仅在 index.php 页面上强制 https 并且每个其他页面都强制为 http 的最佳方法是什么。

谢谢

http nginx https rules conf
  • 1 个回答
  • 337 Views
Martin Hope
Dave
Asked: 2016-11-05 18:27:57 +0800 CST

如何设置我的 nginx 文件来重写我的 URL?

  • 0

我在 Ubuntu 14.04 上使用 nginx (1.4.6-1ubuntu3.4)。例如,当有人访问一个页面时http://mymaindomain.com/page1,我想重写它以包含www子域。因此,如果有人访问了之前的 URL,则重写后的 URL 将是http://www.mymaindomain.com/page1. 所以我添加了一个“服务器”指令:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {
…
}

server {
  server_name mymaindomain.com;
  rewrite ^ http://www.mymaindomain.com$request_uri permanent;
}

到我/etc/nginx/nginx.conf文件的末尾。但是重新启动服务器后,我收到错误消息:

2016/11/04 22:12:33 [emerg] 1063#0: "server" directive is not allowed here in /etc/nginx/nginx.conf:75

设置我的 nginx 服务器以正确重写我的 URL 的正确方法是什么?

rewrite nginx conf
  • 1 个回答
  • 114 Views
Martin Hope
Olivier H
Asked: 2016-08-25 07:11:54 +0800 CST

Apache HTTPD:具有代理和目录别名的虚拟主机的 URL 解析

  • 2

这是我的环境的样子:

  • REST api (django),通过端口上的 WSGI (mod_wsgi) 运行http://server:8107/api
  • API站点的静态文件(我有一些管理页面),在一个目录中,比如说/opt/wsgi/staticfiles/subdomain
  • Web 应用程序(expressjs),在 pm2/nodejs 上运行,onhttp://server:3002/

我需要将所有这些分组在端口 80 上的虚拟主机下,如下所示:

  • http://subdomain.server/api : 其余 API
  • http://subdomain.server/api/static:API站点需要的静态文件
  • http://subdomain.server/:网络应用程序

这是配置的相关部分:

<VirtualHost *:80>

    ServerName subdomain.server
    ServerAlias subdomain.server.local

    Alias /api/static/ /opt/wsgi/staticfiles/subdomain/
    <Directory /opt/wsgi/staticfiles/subdomain/ >
        Order Allow,Deny
        Allow from All
        Options -Indexes
        IndexOptions Charset=UTF-8
    </Directory>

    ProxyPass /api http://127.0.0.1:8107/api
    ProxyPassReverse /api http://127.0.0.1:8107/api

    ProxyPass / http://127.0.0.1:3002/
    ProxyPassReverse / http://127.0.0.1:3002/

</VirtualHost>

现在,当我尝试访问静态资源(例如/api/static/js/jquery.js)时,我发现 URL 不是首先由 Alias 指令解析,而是传递给 WSGI 应用程序(/api),然后显然会引发 404 错误。

重新排序指令似乎没有任何效果。

我应该改变什么以确保 HTTPD 将/api/static在其他任何事情之前服务?

*编辑*:我在 CentOS 6.5 发行版下运行 Apache HTTPD 2.2.15
virtualhost proxy httpd conf static-files
  • 1 个回答
  • 822 Views
Martin Hope
NaturalDevCR
Asked: 2016-06-27 23:38:48 +0800 CST

NGINX index.php 重写规则不起作用

  • 1

最近我将我的网络服务器从 cpanel 和 CENTOS 7 更改为使用 nginx 和一个名为 nDeploy 的 scipt,它与 wordpress 和托管在我服务器上的站点配合得很好。

我有这个脚本不起作用。由于 nginx 配置,我的站点使用主 index.php 访问大多数页面,并带有一些 php 模板解决方案,但我只收到此错误:"500 too many redirects"

所以这是我的 .htaccess (当我使用 apache 时,这就是诀窍):

    Options +FollowSymLinks

RewriteEngine On 
RewriteRule ^([^/]*)\.php$ index.php?page=$1 [L,QSA]

这是我的 nginx 配置文件:

# Downloads
rewrite ^/downloads/([0-9]+)/([^/]*)$ /./downloads.php?action=displaycat&catid=$1 last;
rewrite ^/downloads$ /./downloads.php last;

#Knowledgebase
rewrite ^/knowledgebase/([0-9]+)/[a-zA-Z0-9-]+\.html$ /./knowledgebase.php?action=displayarticle&id=$1 last;
rewrite ^/knowledgebase/([0-9]+)/([^/]*)$ /./knowledgebase.php?action=displaycat&catid=$1 last;
rewrite ^/knowledgebase$ /./knowledgebase.php last;


location / {
        try_files $uri $uri/ /index.php?$args;
}

location /NaxsiRequestDenied {
       return 418;
   }

location ~ ^/pingphpfpm$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/opt/remi/php56/root/var/run/user.sock;
}

location ~* /\.(?!well-known\/) { deny all; access_log off; log_not_found off; }
autoindex on;

location ~ \.php$ {
    include /etc/nginx/conf.d/naxsi_learn.rules;
    include /etc/nginx/sites-enabled/mysite.com.nxapi.wl;

    try_files $uri =404;
        fastcgi_pass unix:/opt/remi/php56/root/var/run/extranet.sock;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
}

include /etc/nginx/conf.d/cpanel_services.conf;
# nginx configuration
location / {
rewrite ^/([^/]*)\.php$ /index.php?page=$1 break;
}

这是我的 index.php 文件:

<?php ob_start();
include "inc/config.php";
    $page = $_GET["page"];  
    if(!isset($page) || $page == "" ){ 
        header("Location:".SITE."index.php");
        exit();
    }
    $access = 1;

include "inc/template.php";
ob_flush();
?>
php .htaccess nginx conf
  • 1 个回答
  • 1138 Views
Martin Hope
Konrad
Asked: 2016-06-21 13:31:20 +0800 CST

重定向循环 - apache

  • 0

我试图弄清楚为什么我的 apache 配置给了我一个无限重定向循环。我已经尝试了一切,但循环仍然存在。

有趣的是,当您用 app_dev.php 替换最后一个重定向 (app.php) 时,它运行良好(Symfony 开发环境),但是用 app.php 替换它会导致循环。

我正在查看代码,但不知道那可能是什么。有什么线索吗?

<VirtualHost 178.62.109.124:8080>

ServerName messpace.com
ServerAlias www.messpace.com
ServerAdmin [email protected]
DocumentRoot /home/admin/web/messpace.com/public_html
ScriptAlias /cgi-bin/ /home/admin/web/messpace.com/cgi-bin/
Alias /vstats/ /home/admin/web/messpace.com/stats/
Alias /error/ /home/admin/web/messpace.com/document_errors/
#SuexecUserGroup admin admin
CustomLog /var/log/apache2/domains/messpace.com.bytes bytes
CustomLog /var/log/apache2/domains/messpace.com.log combined
ErrorLog /var/log/apache2/domains/messpace.com.error.log
<Directory /home/admin/web/messpace.com/public_html>
    AllowOverride All
    Options +Includes -Indexes +ExecCGI
</Directory>
<Directory /home/admin/web/messpace.com/stats>
    AllowOverride All
</Directory>

<IfModule mod_ruid2.c>
    RMode config
    RUidGid admin admin
    RGroups www-data
</IfModule>
<IfModule itk.c>
    AssignUserID admin admin
</IfModule>

#IncludeOptional /home/admin/conf/web/apache2.messpace.com.conf*


Alias /sf /$data_dir/symfony/web/sf
RewriteEngine On
# Rewrite assets path
RewriteRule ^/?images/(.*)$ /web/images/$1  [L]
RewriteRule ^/?css/(.*)$ /web/css/$1  [L]
RewriteRule ^/?js/(.*)$ /web/js/$1  [L]
RewriteRule ^/?font-awesome/(.*)$ /web/font-awesome/$1  [L]
RewriteRule ^/?fonts/(.*)$ /web/fonts/$1  [L]
RewriteRule ^/?bower_components/(.*)$ /web/bower_components/$1  [L]
RewriteRule ^/web/app.php - [L]
ErrorLog /var/log/apache2/domains/messpace.com.error.log
#SuexecUserGroup admin admin
CustomLog /var/log/apache2/domains/messpace.com.bytes bytes
CustomLog /var/log/apache2/domains/messpace.com.log combined
LogLevel warn rewrite:trace8
<Directory /home/admin/web/messpace.com/public_html>
    AllowOverride All
    Options +Includes -Indexes +ExecCGI -MultiViews     +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>
<Directory /home/admin/web/messpace.com/stats>
    AllowOverride All
</Directory>
<IfModule mod_ruid2.c>
    RMode config
    RUidGid admin admin
    RGroups www-data
</IfModule>
# IncludeOptional /home/admin/conf/web/apache2.messpace.com.conf*
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

# Explicitly disable rewriting for front controllers
RewriteRule ^/web/app_dev.php - [L]

RewriteRule ^/web/app.php - [L]
# Fix the bundles folder
RewriteRule ^bundles/(.*)$ /web/bundles/$1  [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/web/app.php

# Change below before deploying to production
#RewriteRule ^(.*)$ /web/app_dev.php [QSA,L]
RewriteRule  ^(.*)$ /web/app.php [QSA,L]

有任何想法吗?谢谢!

redirect conf
  • 1 个回答
  • 729 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