nginx на сервере #1 (получает все запросы и отправляет их на сервер № 2)
wordpress Веб -сайт на сервере #2, расположенный в пользовательском Местоположение:
Пример домена: пример. Пример. ETC/PHP/8.3/fpm/pool.d/www.conf Содержание:
Код: Выделить всё
[www]
chroot = /home/company/server/example/website
user = www-data
group = www-data
listen = 0.0.0.0:9000
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
process.dumpable = yes
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
Код: Выделить всё
define( 'WP_DEBUG', true );
define( 'CONCATENATE_SCRIPTS', false );
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);
define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
define( 'WP_SITEURL', WP_HOME );
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
require_once ABSPATH . 'wp-settings.php';
< /code>
Сервер #1 nginx config: < /p>
server {
listen 443 ssl http2;
ssl_certificate /home/company/server/ssl/cert.pem;
ssl_certificate_key /home/company/server/ssl/private_key.key;
server_name example.com www.example.com;
# Enabling compression
gzip on;
root /;
index index.php index.html;
location ~* \.php$ {
include mime.types;
include snippets/fastcgi-php.conf;
fastcgi_pass 192.168.100.56:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
include proxy.conf;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
root /wp-includes;
try_files $uri =404;
expires max;
log_not_found on;
}
# Deny access to sensitive files
location ~* \.(htaccess|htpasswd|ini|log|sh|sql|bak|conf)$ {
deny all;
}
}
Код: Выделить всё
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
# Proxy SSL
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_ssl_ciphers DEFAULT;
# Proxy headers
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Forwarded $proxy_add_forwarded;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Method $request_method;
proxy_buffering on;
proxy_cache off;
proxy_cache_bypass $http_upgrade;
proxy_pass_header X-XSRF-TOKEN;
proxy_set_header Origin $http_origin;
proxy_pass_request_headers on;
#proxy_redirect off;
# Proxy timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
Эти ошибки возникают в консоли Dev Hrome Dev:
"отказался выполнять скрипт из '', потому что его тип панели ('text /html') не исполняется, и строгая проверка типа MIME включено "." Для https://www.example.com/wp-includes/js/ ... ver=2.0.11
и для других, таких как https: //www.example .com/wp-includes/js/underscore.min.js? ver = 1.13.7 "net :: err_aborted 404 (не найдено)"
Скажите, пожалуйста, где ошибка. Что неправильно настроено
Подробнее здесь: https://stackoverflow.com/questions/793 ... -not-found