Wordpress AJAX 和 API 在 VPS 上的 json 响应之前调用打印文件名和权限
Wordpress AJAX and API calls printing filenames and permissions before the json response on VPS
我正在尝试将 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":[]}}
我覆盖了永久链接,更改了 db 中的 url,将每个文件和文件夹相应地更改为 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}/ [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/ [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
感谢任何帮助。
已解决。通过 wget ftp 将文件从共享主机传输到 VPS 时,在每个文件夹中创建了一个新的 .listing 文件。
只需要启动
find . -name ".listing" -type f -delete
在网站根文件夹中,问题消失了。
我正在尝试将 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":[]}}
我覆盖了永久链接,更改了 db 中的 url,将每个文件和文件夹相应地更改为 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}/ [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/ [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
感谢任何帮助。
已解决。通过 wget ftp 将文件从共享主机传输到 VPS 时,在每个文件夹中创建了一个新的 .listing 文件。
只需要启动
find . -name ".listing" -type f -delete
在网站根文件夹中,问题消失了。