Articles of configuration

如何阻止来自特定用户代理的Nginx访问日志语句

我正在closures来自http用户代理的特定请求的日志logging在Nginx的访问日志文件。 基本上来自亚马逊ELB健康检查和我们的外部(Pingdom)监测。 由于这些来自每隔几秒钟,使testing难以sorting通过日志。 "GET / HTTP/1.1" 200 727 "-" "ELB-HealthChecker/1.0" "GET /login HTTP/1.1" 200 7492 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)" 我能够阻止图像文件的日志logging,但没有看到任何传入的请求: location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml|svg)$ { access_log off; expires 30d; } 提前致谢! 所以我尝试了@Gnarfoz的build议,但是有一些有趣的副作用。 虽然这两个“健康检查”没有logging,Pingdom开始认识到服务器即使在启动和运行。 这很有趣,因为Load Balancer没有这样做,如果有的话,它会丢弃我们正在testing的节点。 我把MAP部分放在我的日志下面的HTML块中: access_log /www/access.log; error_log /www/error.log; map $http_user_agent $ignore_ua { default 0; "~Pingdom.*" 1; "ELB-HealthChecker/1.0" 1; } 我把IF语句放在我的服务器块中,默认位置是: location / { try_files $uri $uri/ […]

基于nginx查询参数的代理传递

有没有办法根据查询参数代理通行证? 我需要代理传递根URL请求到服务器A.但是,如果根url有一定的查询参数,我需要代理传递给服务器B.我怎么能实现这一点? 以下是我目前的configuration: location / { proxy_pass http://xxxxxx; proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; }

保护主Ansible用户

对Ansible主用户来说,似乎只有两种合理的方法: 使用root 使用NOPASSWD sudo访问另一个用户(例如, ansible ) 第一个选项是禁止使用,因为我不敢保持PermitRootLogin 。 所以,默认情况下,第二个选项似乎是要走的路。 我至less在/etc/ssh/sshd_config : Match User ansible PasswordAuthentication No 并通过使用authorized_keys的from选项将密钥用法限制到Ansible主机: from="192.168.100/24" 到目前为止,我的想法还有其他想法或问题吗?

木偶:如何覆盖/重新定义外部子类(详细的用例和示例)

我试图说明的用例是什么时候声明某个项目(eq mysqld服务)与默认configuration,可以包含在每个节点(class stripdown在这个例子中,basenode),仍然能够覆盖这个相同的项目一些特定的类(例如mysql :: server),被特定的节点(如myserver.local) 我用下面的例子说明了这个用例,我想在所有节点上禁用mysql服务,但是在特定的节点上激活它。 但是当然,Puppetparsing失败,因为Service [mysql]包含两次。 当然,mysql :: server类没有任何关系,可以作为剥离类的子类 有没有办法来覆盖服务[“MySQL”],或将其标记为主要的,或者其他? 我正在考虑虚拟物品和实现function,但它只允许多次应用物品,而不是重新定义或覆盖。 # In stripdown.pp : class stripdown { service {"mysql": enable => "false", ensure => "stopped" } } # In mysql.pp : class mysql::server { service { mysqld: enable => true, ensure => running, hasrestart => true, hasstatus => true, path => "/etc/init.d/mysql", […]

如何禁用“您是否允许该网站在您的计算机上打开程序?”针对特定程序/名字对象的警告?

我一直在使用Windows中的新URL标识符来处理正在工作的实用程序。 当我从“开始”>“运行”运行新的URL时,它只是运行。 如果我通过Notes将URL发送给自己,或者将其input到IE地址栏中,我会看到一个窗口,其中显示: "Do you want to allow this website to open a program on your computer?" Program: UrlMonikerTest1 Address: urltest://ticket?param1=42&param2=Derf [CheckBox] Always ask before opening this type of address [Button] Allow [Button] Cancel Allowing web content to open a program can be useful, but it can potentially harm your computer. Do not allow it […]

优化多个gunicorn实例的工作人员数量

我正在configurationgunicorn(由supervisord监听,并在nginx前端后面),并且对于设置的最佳进程数量感到困惑。 在文件中明确解释说: workers = multiprocessing.cpu_count() * 2 + 1 我的机器是一个四核心,所以应该算9名工人。 但是我想运行几个应用程序,每个应用程序都听一个不同的端口。 那么计数应该(截断): workers_per_application = int(workers / NUM_APPLICATIONS) 还是应该每个人都有上述数量的工人? 我认为这个问题实际上不仅适用于gunicorn,而且适用于所有类似的监听服务器。

限制一些SSH用户只有公钥authentication的最佳方法(禁用密码authentication)

我在Yosemite上运行Mac OS X Server.app,并且在/etc/sshd_config (缺省情况下,启用了publickey和password auth)中为默认设置的用户启用了SSH。 但是,我需要限制的git本地用户只有通过SSH publickey访问。 完全公开,Server.app启用一些额外的Kerberos和GSSAPI选项(尽pipe我不是100%确定这些如何影响我的问题): # Kerberos options KerberosAuthentication yes KerberosOrLocalPasswd yes KerberosTicketCleanup yes # GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials yes GSSAPIStrictAcceptorCheck yes GSSAPIKeyExchange no /etc/sshd_config说明如下: # To disable tunneled clear text passwords both PasswordAuthentication and # ChallengeResponseAuthentication must be set to "no". 但是, ChallengeResponseAuthentication在匹配语句中是不允许的,所以我试着只禁用密码validation: Match User git PasswordAuthentication no 这不起作用 […]

在php-fpm confs中设置php值而不是php.ini

我想在php-fpm conf文件中设置通常在php.ini中设置的值。 我正在使用nginx。 我已经创build了以下设置,但我不确定这是否可行。 php_value[memory_limit] = 96M php_value[max_execution_time] = 120 php_value[max_input_time] = 300 php_value[php_post_max_size] = 25M php_value[upload_max_filesize] = 25M 你觉得如果这样可以吗? 当一个值在php.ini和php-fpm conf文件中设置时会发生什么? php-fpm覆盖了ini之一? 最后,这不是一个问题,我可以为所有虚拟主机设置不同的值? 我的意思是php.ini似乎是一个全局设置,而这是主机的依赖。 不同的主机可以运行不同的内存限制等?

将本地configuration文件迁移到漫游configuration文件

什么是“需要考虑的事情”以及将大量用户从使用本地configuration文件迁移到漫游用户的最佳实践?

更改Powershell $概要文件目录

我想知道如何改变我的$ profilevariables指向的位置。 PS H:\> $profile H:\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 H:\是一个networking共享,所以当我创build我的configuration文件,并加载PowerShell时,我得到以下内容: 安全警告仅运行您信任的脚本。 虽然来自Internet的脚本可能有用,但此脚本可能会损害您的计算机。 你想运行H:\ WindowsPowerShell \ Microsoft.PowerShell_profile.ps1吗? [D]不运行[R]运行一次[S]暂停[?]帮助(默认为“D”): 据微软称,$ profile的位置由%USERPROFILE%环境variables决定 。 这不是真的: PS H:\> $env:userprofile C:\Users\username 例如,我有一台XP机器如何工作: PS H:\> $profile C:\Documents and Settings\username\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 PS H:\> $env:userprofile C:\Documents and Settings\username PS H:\> $env:homedrive H: PS H:\> $env:homepath \ 这是从Vista机器相同的输出$ profile指向错误的地方: PS H:\> $profile H:\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 PS H:\> $env:userprofile C:\Users\username PS […]