更新时间:2022-04-17 01:45:53
实际上,我找到了解决方法!我的nginx配置出现错误,如果有人感兴趣,这是我的最终工作配置:
Actually I found my way through it ! I had an error in my nginx configuration and if anyone is interested, here is my final working configuration :
nginx.conf文件(wordpress bloc):
nginx.conf file (wordpress bloc) :
location /blog/ {
proxy_pass http://127.0.0.1:8093/;
proxy_http_version 1.1;
proxy_buffering off;
proxy_read_timeout 90;
proxy_connect_timeout 90;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header Proxy "";
}
这是我在wordpress容器的wp_config.php文件顶部添加的内容:
Here is what I added at the top of wp_config.php file of my wordpress container :
define('FORCE_SSL_ADMIN', true);
$_SERVER['REQUEST_URI'] = str_replace("/wp-admin/", "/blog/wp-admin/", $_SERVER['REQUEST_URI']);
if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}
define('WP_HOME','https://test.com/blog/');
define('WP_SITEURL','https://test.com/blog/');
干杯!