403禁止错误出现在管理员面板以及admin-ajax.php文件中。

huangapple go评论93阅读模式
英文:

403 forbidden error in the admin panel as well as on the admin-ajax.php file

问题

I am using WordPress, My website was working perfectly until I changed the file permission. admin-ajax.php is showing 403 forbidden error and the rest of the file is working. due to a 403 error, My website is completely down and now I am not able to understand what permission I have to set for this file. I have tried 777,755,644,640 but still I am getting 403 error. I thought let me login in admin panel and deactivate the plugin but my admin panel is showing like below image. But, I am 100% sure there is no issue with the plugin. I have deleted the htaccess file and added the new one but still same issue. I have added the below code in the wp-config.php file and it's showing perfectly but if I click on any of the menus like, plugin, setting, tool, post, or pages, all the pages are showing 403 forbidden. Any idea what permission I have to set? I am using an AWS server. I am not 100% sure but I can see that all the folders have a .htaccess file created and found the below code. I haven't created that file yet. Is this the correct code?

英文:

I am using WordPress, My website was working perfectly until I changed the file permission.

admin-ajax.php is showing 403 forbidden error and the rest of the file is working.

due to a 403 error, My website is completely down and now I am not able to understand what permission I have to set for this file. I have tried 777,755,644,640 but still I am getting 403 error

403禁止错误出现在管理员面板以及admin-ajax.php文件中。

I thought let me login in admin panel and deactivate the plugin but my admin panel is showing like below image. But, I am 100% sure there is no issue with the plugin. I have deleted the htaccess file and added the new one but still same issue

403禁止错误出现在管理员面板以及admin-ajax.php文件中。

I have added the below code in the wp-config.php file and it's showing perfectly but if I click on any of the menus like, plugin, setting, tool, post, or pages, all the pages are showing 403 forbidden

define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);
define( 'CONCATENATE_SCRIPTS', false );
define( 'SCRIPT_DEBUG', true );

Any idea what permission I have to set? I am using an AWS server.

I am not 100% sure but I can see that all the folders have a .htaccess file created and found the below code. I haven't created that file yet. Is this the correct code?

<FilesMatch ".(py|exe|php)$">
 Order allow,deny
 Deny from all
</FilesMatch>
<FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$">
 Order allow,deny
 Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

答案1

得分: 1

首先尝试通过FTP或Cpanel禁用所有插件/主题,可能是某个插件引起了问题。
其次,如果问题没有解决,您可以通过Cpanel或FTP替换您的.htaccess文件。

英文:

First you try to disable all of your plugin/theme from FTP or Cpanel, may be any plugin cause an issue.
Secondly if issue not solve you can replace your .htacess file through Cpanel or ftp

答案2

得分: 0

如果您正在使用安全插件,例如Wordfence或iThemes Security,您需要在安全插件设置中将URL添加到白名单中。

英文:

if you are using security plugin something like wordfence or ithemes Security, you need to whitelisted url in your security plugin settings.

答案3

得分: 0

你需要检查文件权限,并联系你的托管提供商解决此问题。

英文:

You need to check for the file permission and contact your hosting provider regarding this issue.

答案4

得分: 0

The Ubuntu OS(您在租用的AWS服务器上运行的操作系统)使用www-data:www-data用户和组来运行Apache Web服务器。通常,这与您的Shell用户不同。

所以尝试将您的文件所有者更改为该用户。如果您的顶级目录是/var/www,请尝试执行以下操作以更改文件的所有权和权限。

cd /var/www
sudo chown -R www-data:www-data .
sudo find . -type f -exec chmod a+r {} \;
sudo find . -type d -exec chmod a+rx {} \;

然后,每当您从Shell用户操作文件时,使用www-data用户。例如,如果您使用wpcli,请在您的Shell命令前加上sudo -u www-data

sudo -u www-data wp config list

注意:如果没有Web服务器访问admin-ajax.php,WordPress将无法正常工作。

如果这对您不起作用,请提出另一个问题,并向我们展示Shell命令ls -alh /var/www/wp-admin/admin-ajax.php的输出,以便我们查看您的文件保护。

英文:

The Ubuntu OS (which you're running on your rented AWS server) uses the www-data:www-data user and group to run the Apache web server. Usually that's a different user and group from your shell user.

So try making your files owned by that user. If your top-level directory is /var/www try this to change the ownership and the permissions of your files.

cd /var/www
sudo chown -R www-data:www-data .
sudo find . -type f -exec chmod a+r {} \;
sudo find . -type d -exec chmod a+rx {} \;

Then, whenever you operate on your files from your shell user, do so with the www-data user. For example, if you use wpcli do this sort of thing, prefixing your shell commands with sudo -u www-data.

sudo -u www-data wp config list

Note: without web server access to admin-ajax.php WordPress doesn't work properly.

If this doesn't work for you ask another question and show us the output of the shell command ls -alh /var/www/wp-admin/admin-ajax.php so we can see your file protection.

huangapple
  • 本文由 发表于 2023年5月30日 10:21:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76361253.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定