
문제를 디버깅하는 중입니다.MoinMoin
CentOS에서는 권한 오류가 발생하지만 문제가 있는 파일/디렉토리가 어디에 있는지 추적할 수 없습니다.
나는 strace -vp <pid>
아파치 PID를 실행했습니다. 문제가 발생하면 다음과 같은 내용이 표시됩니다.
epoll_wait(10, {{EPOLLIN, {u32=3487534344, u64=140367313734920}}}, 2, 10000) = 1
accept4(6, {sa_family=AF_INET6, sin6_port=htons(52621), inet_pton
(AF_INET6, "::ffff:105.193.30.91", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, [28], SOCK_CLOEXEC) = 11
## Later on...
read(7, 0x7fffa658ad7f, 1) = -1 EAGAIN (Resource temporarily
unavailable)
그러나 Apache가 이미 실행 open()
중이므로 7
; 따라서 권한 문제가 보이지만 여전히 모르겠습니다.어느파일이 문제입니다.
Apache를 다시 생성할 때 열려 있는 모든 파일을 포착하려고 시도할 수 있다는 것을 알고 있지만 파일을 실제 파일 이름에 매핑할 수 있는 방법이 있기를 바랍니다 7
... 이를 수행할 수 있는 방법이 있습니까?
편집 1:
@lain 님의 안내에 따라 실행해 보았 lsof | grep 266474069
으나 결과가 불분명합니다...
[root@lnxlmf moin]# ls -la /proc/9707/fd/7
lr-x------. 1 root root 64 Aug 28 15:39 /proc/9707/fd/7 -> pipe:[266474069]
[root@lnxlmf moin]#
[root@lnxlmf moin]# lsof | grep 266474069
httpd 9703 root 7r FIFO 0,8 0t0 266474069 pipe
httpd 9703 root 8w FIFO 0,8 0t0 266474069 pipe
httpd 9705 apache 7r FIFO 0,8 0t0 266474069 pipe
httpd 9705 apache 8w FIFO 0,8 0t0 266474069 pipe
httpd 9706 apache 7r FIFO 0,8 0t0 266474069 pipe
httpd 9706 apache 8w FIFO 0,8 0t0 266474069 pipe
httpd 9707 apache 7r FIFO 0,8 0t0 266474069 pipe
httpd 9707 apache 8w FIFO 0,8 0t0 266474069 pipe
httpd 9733 apache 7r FIFO 0,8 0t0 266474069 pipe
httpd 9733 apache 8w FIFO 0,8 0t0 266474069 pipe
[root@lnxlmf moin]#
이것이 FIFO 파이프라는 것을 알 수 있습니다. 그러나 이것이 내 시스템 구성에 어떤 의미가 있습니까? 문제 의 근본 원인을 어떻게 추적할 수 있습니까 EAGAIN
?
편집 2:
@Alan Curry 덕분에 달리기를 하면 strace -fp <pid_of_wsgi_proc>
좀 더 멀리 갈 수 있는 것 같아요...
[pid 9731] stat("/opt/moin/share/moin/wikiconfig.py", {st_mode=S_IFREG|0770, st_size=6463, ...}) = 0
[pid 9731] stat("/opt/moin/share/moin/data/pages", {st_mode=S_IFDIR|0770, st_size=4096, ...}) = 0
[pid 9731] access("/opt/moin/share/moin/data/pages", R_OK|W_OK|X_OK) = -1 EACCES (Permission denied)
그러나 Apache와 사용자 wsgi
로 실행 모두 apache
...
[root@lnxlmf moin]# ps auxw | grep -E "apache|wsgi"
apache 10187 0.0 0.1 373488 5884 ? Sl 17:18 0:00 moin_http_wsgi
apache 10188 0.0 0.1 373488 5884 ? Sl 17:18 0:00 moin_https_wsgi
apache 10189 0.0 0.1 185096 5824 ? S 17:18 0:00 /usr/sbin/httpd
root 10243 0.0 0.0 103240 848 pts/1 S+ 17:21 0:00 grep -E apache|wsgi
[root@lnxlmf moin]#
그러나 다음 명령을 실행하고 Apache를 다시 시작해도 여전히 문제를 해결할 수 없습니다...
[root@lnxlmf moin]# pwd
/opt/moin/share/moin
[root@lnxlmf moin]# chown -R apache:apache data/
[root@lnxlmf moin]# sudo chmod -R ug+rwx data/
[root@lnxlmf moin]# sudo chmod -R o-rwx data/
나는 이것을 내 위키 http 구성에서 사용하고 있습니다:
<VirtualHost *:443>
ServerName netwiki.foo.com
DocumentRoot /opt/moin/share/moin
WSGIScriptAlias / /opt/moin/share/moin/server/moin.wsgi
WSGIDaemonProcess moin_https display-name=moin_https_wsgi \
user=apache group=apache \
processes=1 threads=10 maximum-requests=1000 umask=0007
WSGIProcessGroup moin_https
WSGIApplicationGroup %{GLOBAL}
# Generate with...
# openssl req -new -x509 -days 365 -nodes -out netwiki.pem -keyout netwiki.key
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/netwiki.pem
SSLCertificateKeyFile /etc/httpd/ssl/netwiki.key
</VirtualHost>
답변1
/proc/<PID>/fd
열려 있는 모든 파일을 나열해야 하는 항목을 살펴보세요 PID
.
내 CentOS 시스템에서 fd 7은
lrwx------. 1 root root 64 Aug 28 22:01 7 -> socket:[1872522]
netstat -ane | grep 1872522
그런 다음 다음을 사용하여 얻을 수 있습니다.
tcp 0 0 :::443 :::* LISTEN 0 1872522
당신이 사용할 수있는
lsof | grep 266474069
파이프에 대한 정보를 얻으려면.
답변2
내 작은 VPS를 보면 다음과 같은 방법으로 fd 번호를 확인할 수 있습니다.
ll /proc/17684/fd/ |colrm 1 46
0 -> /dev/null
1 -> /dev/null
10 -> /var/www/vhosts/censored.xenuser.org/statistics/logs/error_log
11 -> /var/www/vhosts/censored.de/statistics/logs/error_log
12 -> /var/www/vhosts/censored.org/statistics/logs/error_log
13 -> /var/www/vhosts/xenuser.org/statistics/logs/error_log
14 -> /var/log/apache2/access.log
[그리고 17684는 앞서 추적한 프로세스의 PID입니다.]
답변3
문제는 SELINUX=enforcing
내가 /etc/selinux/config
.
SELINUX=permissive
, 을 설정한 후 SELINUXTYPE=targeted
재부팅하면 wsgi
모든 파일에 올바르게 액세스할 수 있습니다.