Scipts cgi 和 suexec

Scipts cgi 和 suexec

我有一個httpd伺服器

SuexecUserGroup         netmet netmet
DocumentRoot            /home/netmet/html
ServerName
ServerAdmin
ErrorLog                /var/log/httpd/netmet.error
TransferLog             /var/log/httpd/netmet.access
DirectoryIndex          index.cgi index.html

AliasMatch              /netmet-cgi-bin/nmHOST-4.*-DETAILS(.*)\.cgi /usr/lib/cgi-bin/netmet-cgi-bin/nmHOST-DETAILS$1.cgi
AliasMatch              /netmet-cgi-bin/nmHOST-4.*-SERVICES(.*)\.cgi /usr/lib/cgi-bin/html/netmet-cgi-bin/nmHOST-SERVICES$1.cgi
AliasMatch              /netmet-cgi-bin/nmTOP_NforORGA4-.*\.cgi /usr/lib/cgi-bin/netmet-cgi-bin/nmTOP_NforORGA.cgi

AddHandler              cgi-script .cgi .pl

當我嘗試使用我的伺服器存取這些腳本時,我得到500內部伺服器錯誤所以我檢查error.log

[Fri Jun 02 09:07:01.467017 2017] [core:notice] [pid 31617] AH00094: Command line: '/usr/sbin/apache2'
suexec policy violation: see suexec log for more details

現在suexec.log

[2017-06-02 09:07:26]: uid: (1001/netmet) gid: (1001/netmet) cmd: index.cgi
[2017-06-02 09:07:26]: command not in docroot (/home/netmet/html/index.cgi)

在網上尋找解決方案後,人們建議這樣做

~# /usr/lib/apache2/suexec -V
-D SUEXEC_CONFIG_DIR=/etc/apache2/suexec/
-D AP_GID_MIN=100
-D AP_LOG_EXEC="/var/log/apache2/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=100

為什麼文檔根目錄不顯示?

答案1

您可以在安裝 apache2-suexec-custom 後更改它:

apt-get install apache2-suexec-custom

並更改配置:

/etc/apache2/suexec

並重新啟動apache2服務

相關內容