amazon linux(EC2)でnginxとphp-fpmを動かすようにしたいのですが、
403エラーとなってしまいました。
/etc/php-fpm.d/www.conf
のuserとgroupをnginxにしているので、
/etc/nginx/nginx.conf
で指定しているドキュメントルートの所有者とグループをnginx、権限を755にしております。
EC2自体はec2-userでsshログインして、nginxのインストール等は、rootで行いました。
何か原因がわかる方がいらっしゃいましたら、ご教授いただけますでしょうか。
環境や、設定ファイルの中身は以下のようになっております。
環境
- Amazon Linux 2017.03
- nginx 1.10.2
- PHP 7.0.16
ドキュメントルートの情報
$ ls -la /var/www/html/ 合計 12 drwxrwxrwx 2 nginx nginx 4096 7月 2 07:54 . drwxr-xr-x 8 root root 4096 7月 1 03:37 .. -rwxr-xr-x 1 nginx nginx 17 7月 2 07:54 index.php
各ファイルの中身
- /etc/nginx/nginx.conf
nginx.conf
1#user nobody; 2worker_processes 1; 3 4#error_log logs/error.log; 5#error_log logs/error.log notice; 6#error_log logs/error.log info; 7 8#pid logs/nginx.pid; 9 10events { 11 worker_connections 1024; 12} 13 14http { 15 include mime.types; 16 default_type application/octet-stream; 17 18 19 #access_log logs/access.log main; 20 21 sendfile on; 22 #tcp_nopush on; 23 24 #keepalive_timeout 0; 25 keepalive_timeout 65; 26 27 server { 28 listen 80 default_server; 29 root /var/www/html; 30 index index.php index.html index.htm; 31 server_name localhost; 32 33 location ~ [^/]\.php(/|$) { 34 fastcgi_split_path_info ^(.+\.php)(/.+)$; 35 if (!-f $document_root$fastcgi_script_name) { 36 return 404; 37 } 38 fastcgi_index index.php; 39 include fastcgi_params; 40 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 41 fastcgi_param PATH_INFO $fastcgi_path_info; 42 fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 43 } 44 } 45 46} 47
- /etc/php-fpm.d/www.conf
Start a new pool named 'www'. ; the variable $pool can we used in any directive and will be replaced by the ; pool name ('www' here) [www] ; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on ; a specific port; ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. listen = /var/run/php-fpm/php-fpm.sock pm = dynamic pm.max_children = 50 ; The number of child processes created on startup. ; Note: Used only when pm is set to 'dynamic' ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 pm.start_servers = 5 ; The desired minimum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.min_spare_servers = 5 ; The desired maximum number of idle server processes. ; Note: Used only when pm is set to 'dynamic' ; Note: Mandatory when pm is set to 'dynamic' pm.max_spare_servers = 35 ; Note: path INI options can be relative and will be expanded with the prefix ; (pool, global or @prefix@) ; Default Value: nothing is defined by default except the values in php.ini and ; specified at startup with the -d argument ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com ;php_flag[display_errors] = off php_admin_value[error_log] = /var/log/php-fpm/7.0/www-error.log php_admin_flag[log_errors] = on ;php_admin_value[memory_limit] = 128M ; Set data paths to directories owned by process user php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/7.0/session php_value[soap.wsdl_cache_dir] = /var/lib/php/7.0/wsdlcache ;php_value[opcache.file_cache] = /var/lib/php/7.0/opcache
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/02 09:21
2017/07/02 09:22