wordpress .htaccess权限修改
wordpress配置页面显示如下
错误:您的 .htaccess 文件无法写入,因此无法自动更新。 这些是 .htaccess 文件所需的 mod_rewrite 规则。 单击该字段并按下 Ctrl + A(Mac 请按下 ⌘ + A)进行全选。
重写规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

解决如下:
更改文件权限 – 高级管理手册 | Developer.WordPress.org
stevenroc@stevenroc:/var/www/html $ sudo nano .htaccess
stevenroc@stevenroc:/var/www/html $ sudo ls -l .htaccess
-rw-r–r– 1 root root 810 Jan 20 15:16 .htaccess
修改权限如下
stevenroc@stevenroc:/var/www/html $ sudo chmod -v 666 .htaccess
mode of ‘.htaccess’ changed from 0644 (rw-r–r–) to 0666 (rw-rw-rw-)
stevenroc@stevenroc:/var/www/html $ sudo ls -l .htaccess
-rw-rw-rw- 1 root root 810 Jan 20 15:16 .htaccess
参考如下:
# 将 .htaccess 所有者改为 www-data(Debian/Ubuntu)
sudo chown www-data:www-data /var/www/html/.htaccess
# 如果是 CentOS/RHEL,用户可能是 apache
sudo chown apache:apache /var/www/html/.htaccess
# 方法1:查看进程
stevenroc@stevenroc://var/www/html $ ps aux | grep -E ‘apache|nginx|php’
root 78891 0.0 0.4 264992 40976 ? Ss 04:55 0:01 /usr/sbin/apache2 -k start
www-data 79203 0.0 1.3 354624 107792 ? S 05:04 0:07 /usr/sbin/apache2 -k start
www-data 98022 0.0 1.1 350016 95824 ? S 12:36 0:02 /usr/sbin/apache2 -k start
www-data 98185 0.0 1.2 352448 100496 ? S 12:40 0:02 /usr/sbin/apache2 -k start
www-data 98379 0.0 1.1 351616 97552 ? S 12:45 0:01 /usr/sbin/apache2 -k start
www-data 98452 0.0 1.2 351456 100336 ? S 12:46 0:00 /usr/sbin/apache2 -k start
www-data 98462 0.7 1.3 363392 112512 ? S 12:46 0:44 /usr/sbin/apache2 -k start
www-data 98469 0.0 1.1 351440 95424 ? S 12:46 0:00 /usr/sbin/apache2 -k start
www-data 98471 0.0 1.1 275872 92992 ? S 12:46 0:00 /usr/sbin/apache2 -k start
www-data 98507 0.0 1.1 347696 93552 ? S 12:46 0:00 /usr/sbin/apache2 -k start
www-data 99094 0.0 0.2 266064 20224 ? S 12:51 0:00 /usr/sbin/apache2 -k start
stevenr+ 102418 0.0 0.0 6240 2208 pts/7 S+ 14:24 0:00 grep –color=auto -E apache|nginx|php
# 方法2:查看 PHP 运行用户
grep -r ‘^user’ /etc/php/*/fpm/pool.d/www.conf 2>/dev/null
# 方法3:创建一个 info.php 查看
echo “<?php echo exec(‘whoami’); ?>” | sudo tee /var/www/html/whoami.php
stevenroc@stevenroc://var/www/html $ echo “<?php echo exec(‘whoami’); ?>” | sudo tee /var/www/html/whoami.php
<?php echo exec(‘whoami’); ?>
# 然后浏览器访问 https://your-site/whoami.php

自适应IP