---
title: "DirectAdmin开启Apache和PHP-FPM的STATUS页面"
id: "285"
type: "post"
slug: "directadmin%e5%bc%80%e5%90%afapache%e5%92%8cphp-fpm%e7%9a%84status%e9%a1%b5%e9%9d%a2"
published_at: "2020-05-19T06:52:00+00:00"
modified_at: "2020-11-05T06:57:42+00:00"
url: "https://www.hitsword.org/2020/285.html"
markdown_url: "https://www.hitsword.org/2020/285.md"
excerpt: "1.开启Apache的Status页面："
taxonomy_category:
  - "Centos"
taxonomy_post_tag:
  - "Apache"
  - "DirectAdmin"
  - "PHP"
---

# DirectAdmin开启Apache和PHP-FPM的STATUS页面

1.开启Apache的Status页面：

```
vi /usr/local/directadmin/custombuild/configure/ap2/conf/extra/httpd-info.conf
#在文件末端插入以下内容
#APACHE-STATUS
<Location /apache-status>
    SetHandler server-status
    Require ip 192.168.1 127
</Location>
#APACHE-INFO
<Location /apache-info>
    SetHandler server-info
    Require ip 192.168.1 127
</Location>
```

  
2.开启php-fpm的status页面和慢日志

```
cp /usr/local/directadmin/data/templates/php-fpm.conf /usr/local/directadmin/data/templates/custom/php-fpm.conf
vi /usr/local/directadmin/data/templates/custom/php-fpm.conf
#在文件末端插入以下内容
pm.status_path = /fpm-status
ping.path = /fpm-ping
slowlog = /usr/local/php|PHP_VER|/var/log/slowlog-|USER|.log
request_slowlog_timeout = 15s
```

  
```
cp /usr/local/directadmin/data/templates/virtual_host2.conf /usr/local/directadmin/data/templates/custom/virtual_host2.conf
vi /usr/local/directadmin/data/templates/custom/virtual_host2.conf
#找到<VirtualHost |IP|:|PORT_80| |MULTI_IP|>下一行插入以下内容
|*if HAVE_PHP1_FPM="1"|
        #FPM-STATUS
        <FilesMatch "^fpm-status|fpm-ping$">
                RewriteEngine Off
                SetHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost"
                Require ip 192.168.1 127
        </FilesMatch>
|*endif|
|*if HAVE_PHP2_FPM="1"|
        #FPM-STATUS
        <FilesMatch "^fpm-status|fpm-ping$">
                RewriteEngine Off
                SetHandler "proxy:unix:/usr/local/php|PHP2_RELEASE|/sockets/|USER|.sock|fcgi://localhost"
                Require ip 192.168.1 127
        </FilesMatch>
|*endif|
```

  
```
cp /usr/local/directadmin/data/templates/virtual_host2_secure.conf /usr/local/directadmin/data/templates/custom/virtual_host2_secure.conf
vi /usr/local/directadmin/data/templates/custom/virtual_host2_secure.conf
#找到<VirtualHost |IP|:|PORT_443| |MULTI_IP|>下一行插入以下内容
|*if HAVE_PHP1_FPM="1"|
        #FPM-STATUS
        <FilesMatch "^fpm-status|fpm-ping$">
                RewriteEngine Off
                SetHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost"
                Require ip 192.168.1 127
        </FilesMatch>
|*endif|
|*if HAVE_PHP2_FPM="1"|
        #FPM-STATUS
        <FilesMatch "^fpm-status|fpm-ping$">
                RewriteEngine Off
                SetHandler "proxy:unix:/usr/local/php|PHP2_RELEASE|/sockets/|USER|.sock|fcgi://localhost"
                Require ip 192.168.1 127
        </FilesMatch>
|*endif|
```

  
 以上内容自行修改Require ip部分允许访问IP  
 最后重新生成所有配置文件  
```
cd /usr/local/directadmin/custombuild
./build rewrite_confs
```
