【问题标题】:plesk subfolder /blog wordpress nginx 404 not foundplesk 子文件夹/blog wordpress nginx 404 未找到
【发布时间】:2020-01-13 12:51:29
【问题描述】:

我有一个 aws lightail 实例。在 plesk 面板中我有一个 node.js 网站,其中有一个包含 wordpress 网站的博客文件夹。主网站和博客主页没有问题。但是如果我点击任何博客发布我收到 404 not found nginx 错误。

我更改了 nginx.conf 文件,但没有任何改变。

我在 /var/www/vhosts/system/example.com/conf/ 下的 nginx.conf 文件

server {
listen 171.26.10.103:443 ssl http2;

server_name example.com;
server_name www.example.com;
server_name ipv4.example.com;

ssl_certificate/opt/psa/var/certificates/certSiSwQOP;
ssl_certificate_key/opt/psa/var/certificates/certSiSwQOP;

client_max_body_size 128m;

 # mailconfig
location ~* ^/autodiscover/autodiscover\.xml$ {
try_files $uri @mad;
}
location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
try_files $uri @mad;
}
location @mad {
rewrite ^(.*)$ /mailconfig/ break;

proxy_passhttp://127.0.0.1:8880;
proxy_set_header X-Host$host;
proxy_set_header X-Request-URI$request_uri;
}
 # mailconfig

root "/var/www/vhosts/example.com/httpdocs";
access_log "/var/www/vhosts/system/example.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/example.com/logs/proxy_error_log";

 #extension letsencrypt begin
location ^~ /.well-known/acme-challenge/ {
root /var/www/vhosts/default/htdocs;

types { }
default_type text/plain;

satisfy any;
auth_basic off;
allow all;

location ~ ^/\.well-known/acme-challenge.*/\. {
deny all;
}
}

#extension letsencrypt end

 #extension sslit begin

 #extension sslit end

location / {
proxy_pass https://171.26.10.103:7081;
proxy_set_header Host$host;
proxy_set_header X-Real-IP$remote_addr;
proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;

location /internal-nginx-static-location/ {
alias /var/www/vhosts/example.com/httpdocs/;
internal;
}

location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
proxy_pass https://171.26.10.103:7081;
proxy_set_header Host$host;
proxy_set_header X-Real-IP$remote_addr;
proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;


location ~ "^/files/" {
proxy_pass https://171.26.10.103:7081;
proxy_set_header Host$host;
proxy_set_header X-Real-IP$remote_addr;
proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;

}

location /blog {
index index.php index.html index.htm;
try_files $uri $uri/ /blog/index.php?q=$uri&$args;

}
add_header X-Powered-By PleskLin;

}


server {
listen 172.26.10.103:80;

server_name example.com;
server_name www.example.com;
server_name ipv4.example.com;

client_max_body_size 128m;

 # mailconfig
location ~* ^/autodiscover/autodiscover\.xml$ {
try_files $uri @mad;
}
location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
try_files $uri @mad;
}
location @mad {
rewrite ^(.*)$ /mailconfig/ break;

proxy_passhttp://127.0.0.1:8880;
proxy_set_header X-Host$host;
proxy_set_header X-Request-URI$request_uri;
}
 # mailconfig

return 301 https://$host$request_uri;
}

【问题讨论】:

  • 还缺少 /etc/nginx/sites-enabled/ 文件夹。没有这样的文件夹。

标签: wordpress nginx plesk amazon-lightsail


【解决方案1】:

这解决了我的问题https://support.plesk.com/hc/en-us/articles/213912945 在 Plesk 中,将以下内容添加到 Domains > example.com > Apache & nginx Settings 的 WordPress 域的 Additional nginx directives 字段:

if (!-e $request_filename) {
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
set $test "${test}C";
}
if ($test = PC) {
rewrite ^/(.*)$ /blog/index.php?$1;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-20
    • 2021-07-11
    • 2017-06-20
    • 2020-07-29
    • 2016-09-24
    • 2016-02-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多