Wordpress AJAX和API调用在VPS上的json响应前打印文件名和权限。

问题描述 投票:0回答:1

我正试图将一个Wordpress网站从共享主机转移到VPS。

除了AJAX和API调用外,一切都很顺利。

每个AJAX调用都会在json输出之前打印一些文件和文件夹的权限。

例如,如果我调用

{ROOT}/peepsoajax/chatajax.get_chats

而不是打印

{"has_errors":0,"success":1,"data":{"chats":[]}}

它打印出这样的输出(星号是手动添加的)。

drwxr-xr-x    2 cpk***t   cpk***t         4096 May  4 08:46 .
drwxr-xr-x    3 cpk***t   cpk***t         4096 May  4 08:46 ..
-rw-r--r--    1 cpk***t   cpk***t         4074 May  4 08:46 widgetlimitusers.php
drwxr-xr-x    2 cpk***t   cpk***t         4096 May  4 08:46 .
drwxr-xr-x    3 cpk***t   cpk***t         4096 May  4 08:46 ..
-rw-r--r--    1 cpk***t   cpk***t         4886 May  4 08:46 widgetfriends.php
-rw-r--r--    1 cpk***t   cpk***t        10042 May  4 08:46 widgetfriendsbirthday.php
-rw-r--r--    1 cpk***t   cpk***t         4117 May  4 08:46 widgetmutualfriends.php
drwxr-xr-x    2 cpk***t   cpk***t         4096 May  4 08:46 .
drwxr-xr-x    3 cpk***t   cpk***t         4096 May  4 08:46 ..
-rw-r--r--    1 cpk***t   cpk***t         3635 May  4 08:46 widgetcommunityphotos.php
-rw-r--r--    1 cpk***t   cpk***t         4068 May  4 08:46 widgetphotos.php
drwxr-xr-x    2 cpk***t   cpk***t         4096 May  4 08:46 .
drwxr-xr-x    3 cpk***t   cpk***t         4096 May  4 08:46 ..
-rw-r--r--    1 cpk***t   cpk***t         4872 May  4 08:46 widgetcommunityvideos.php
-rw-r--r--    1 cpk***t   cpk***t         5296 May  4 08:46 widgetvideos.php
{"has_errors":0,"success":1,"data":{"chats":[]}}

我已经覆盖了permalinks,改变了db中的urls,chmod每个文件和文件夹都相应的755和644,设置chown www -data到项目,停用缓存和安全插件... ...

我的.htaccess似乎很好。

# BEGIN rlrssslReallySimpleSSL rsssl_version[3.3.2]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

<Files admin-ajax.php>
    Order allow,deny
    Allow from all
    Satisfy any
</Files>

# BEGIN WordPress
# Le direttive (linee) tra `BEGIN WordPress` e `END WordPress` sono
# generate dinamicamente, e dovrebbero essere modificare solo con i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori sarà sovrascritta.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

我的虚拟主机指令似乎也很好。

DocumentRoot {my_root}/public_html
ServerName {my_server.name}
ServerAdmin webmaster@localhost
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
<Directory "{my_root}/public_html">
Options -Indexes +FollowSymLinks 
AllowOverride All
Require all granted
Allow from all
</Directory>
ServerAlias {my_server.name}

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.my\.servername\.com$
RewriteRule ^(.*)$ https://test.my.servername.com/$1 [R=301,L]

SSLCertificateFile /etc/letsencrypt/live/test.my.servername.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.my.servername.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
IndexOptions SuppressDescription SuppressHTMLPreamble SuppressLastModified SuppressSize
Options ExecCGI FollowSymLinks Includes IncludesNOEXEC Indexes MultiViews SymLinksIfOwnerMatch

任何帮助感谢。

ajax wordpress apache api vps
1个回答
0
投票

解决了。当通过wget ftp从共享主机传输文件到VPS时,每个文件夹中都创建了一个新的.listing文件。

所有它需要的是启动

find . -name ".listing" -type f -delete

在网站根目录下,这个问题就消失了。

© www.soinside.com 2019 - 2024. All rights reserved.