Saya membaca beberapa entri tentang mengapa PHP-FPM mungkin memberi saya izin ditolak tetapi saya tidak bisa menyelesaikannya.
Log kesalahan dibaca seperti:
2013/04/20 23:33:28 [crit] 15479#0: *6 open() "/var/lib/nginx/tmp/fastcgi
/2/00/0000000002" failed (13: Permission denied) while reading upstream, client:
99.999.999.999, server: example.net, request: "GET /wp-admin/ HTTP/1.1",
upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "example.net", referrer:
"http://example.net/"
Saya sedikit tersesat:
- Saya telah mengatur / var / lib / nginx / tmp ke ec2-user (saya bahkan +777 semuanya untuk memeriksa)
- Saya telah mengatur /tmp/php-fpm.sock ke pengguna ec2
- file conf nginx diatur ke pengguna ec2
- php-conf diatur ke pengguna dan grup EC2-pengguna
- ps aux memberikan pengguna ec2 pada semua proses php-fpm dan nginx
Konfigurasi Nginx saya mencakup banyak file, konfigurasi dasar adalah:
user ec2-user ec2-user;
worker_processes 5;
error_log /opt/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /opt/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
client_max_body_size 13m;
index index.php index.html index.htm;
upstream php {
server unix:/tmp/php-fpm.sock;
}
include /etc/nginx/conf.d/*.conf;
include /mnt/web/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/ saya kosong /mnt/web/nginx/conf.d saya mengandung BANYAK konfigurasi situs web yang semuanya termasuk "wordpress.conf":
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass php;
}
/Opt/php/etc/php-fpm.conf saya:
include=/opt/php/etc/fpm.d/*.conf
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
[www]
listen = /tmp/php-fpm.sock
user = ec2-user
group = ec2-user
pm = dynamic
pm.max_children = 250
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
pm.status_path = /fpm-status
ping.path = /fpm-ping
slowlog = log/$pool.log.slow
catch_workers_output = yes
UPDATE: menemukan masalah, taruh di jawabannya