Итак, моя проблема в том, что у меня есть два настроенных сайта, оба с использованием wordpress, которые еще предстоит настроить. Я пытаюсь поместить информацию. php в каждый, чтобы показать php работает, но 404 не найден. На самом деле проблема заключается в том, что я не знаю, работают ли мои nginx серверные блоки. Я сделал чистую установку и даже стер nginx и php -fpm, потому что я пытался использовать генератор серверных блоков nginx. Я могу получить информацию php, которая будет отображаться нормально, когда я захожу на сервер по его IP-адресу. Id переустановил nginx и php успешно, но получаю основную страницу nginx только при попытке go на любом из сайтов, а не на мастере настройки WordPress. Ваша помощь будет принята с благодарностью. Приложены мои nginx .config, каждый серверный блок и несколько запущенных команд.
nginx -t говорит, что nginx файлы конфигурации в порядке
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers PROFILE=SYSTEM;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
PHP -FPM и nginx работают нормально PHP -FPM Статус:
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-07-01 21:31:35 UTC; 1 weeks 2 days ago
Main PID: 66980 (php-fpm)
Status: "Processes active: 0, idle: 6, Requests: 1137, slow: 0, Traffic: 0req/sec"
Tasks: 7 (limit: 11511)
Memory: 44.5M
CGroup: /system.slice/php-fpm.service
├─66980 php-fpm: master process (/etc/php-fpm.conf)
├─66981 php-fpm: pool www
├─66982 php-fpm: pool www
├─66983 php-fpm: pool www
├─66984 php-fpm: pool www
├─66985 php-fpm: pool www
└─77605 php-fpm: pool www
Jul 01 21:31:35 systemd[1]: Stopped The PHP FastCGI Process Manager.
Jul 01 21:31:35 systemd[1]: Starting The PHP FastCGI Process Manager...
Jul 01 21:31:35 systemd[1]: Started The PHP FastCGI Process Manager.
nginx статус:
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/nginx.service.d
└─php-fpm.conf
Active: active (running) since Wed 2020-07-01 21:31:29 UTC; 1 weeks 2 days ago
Process: 66971 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 66967 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 66965 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 66972 (nginx)
Tasks: 3 (limit: 11511)
Memory: 6.4M
CGroup: /system.slice/nginx.service
├─66972 nginx: master process /usr/sbin/nginx
├─66973 nginx: worker process
└─66974 nginx: worker process
Jul 01 21:31:29 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jul 01 21:31:29 nginx[66967]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jul 01 21:31:29 nginx[66967]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jul 01 21:31:29 systemd[1]: Started The nginx HTTP and reverse proxy server.
Мой брандмауэр работает и настроен для прослушивания портов 80 и 443 http и https:
public (active)
target: default
icmp-block-inversion: no
interfaces: eth1
sources:
services: http https other services edited for privacy
ports: edited for privacy
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
netstat -tlnp показывает nginx прослушивание обоих портов 80 и 443
И последнее, но не менее важное, вот файлы конфигурации для каждого блока сервера: server имена переписаны в целях конфиденциальности:
server {
listen 80;
server_name example1.com www.example1.com;
# rewrite ^ https://example1.com$request_uri? permanent;
}
server {
listen 443 ssl http2;
# ssl_certificate /etc/letsencrypt/live/example1.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/example1.com/privkey.pem;
# ssl_stapling on;
server_name example1.com;
root /var/www/example1/public_html;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
серверный блок 2
server {
listen 80;
server_name example.co www.example.co;
# rewrite ^ https://example.co$request_uri? permanent;
}
server {
listen 443 ssl http2;
# ssl_certificate /etc/letsencrypt/live/example.co/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/example.co/privkey.pem;
# ssl_stapling on;
server_name example.co;
root /var/www/example/public_html;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Оба файла серверных блоков находятся в папке /etc/nginx/conf.d/.
Любые предложения, которые помогут мне наладить эту работу, были бы потрясающими и очень благодарны.