Can't get it work. I've been reading the forums and trying here and there. It's a fresh installation on AWS Linux2 AMI (redhat based), installed wordpress at /var/www/wordpress, set permissions, have a phpinfo.php with 775 in there that can't access either (logs below). I only get a http 200 while going to myhostname, nginx landing page. Files have proper permissions as well, process running as nginx, tried changing listen.mode, vhost conf, but nothing, will keep trying. Any help would be much appreciated, let me know if there's a file or settings missing:
vhost: /etc/nginx/sites-available/wp
server {
listen 80;
server_name myhostname;
root /var/www/wordpress/;
charset utf-8;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
include fastcgi_params;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
}
php-fpm: /etc/php-fpm.d/www.conf
; 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 user chosen to provide access to the same directories 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
;listen = 127.0.0.1:9000
access.log = /var/log/$pool.access.log
; Set listen(2) backlog.
; Default Value: 511
;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users = nginx
;listen.acl_groups =
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1
nginx error.log:
2018/07/05 17:32:45 [error] 8322#0: *4 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: myPC-IP, server: _, request: "GET /wp-admin/install.php HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "myhostname"
2018/07/05 17:40:41 [error] 8322#0: *9 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: myPC-IP, server: _, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "myhostname"
/var/log/www.access.log:
- - 05/Jul/2018:17:32:45 +0000 "GET /wp-admin/install.php" 404
- - 05/Jul/2018:17:40:41 +0000 "GET /phpinfo.php" 404
nginx conf.d/php-fpm.conf:
# PHP-FPM FastCGI server
# network or unix domain socket configuration
upstream php-fpm {
server unix:/run/php-fpm/php-fpm.sock;
}