当前位置: 首页 > news >正文

建设网站利用点击量赚钱互联网100个创业项目

建设网站利用点击量赚钱,互联网100个创业项目,个人网站备案备注写什么,中济建设官方网站一、问题描述 今天迁移了wordpress站点至新服务器,结果上传图片出现“无法将上传的文件移动至wp-content/uploads”的提示,这是怎么回事,为什么会这样。 报错如下: 2023/02/20 08:57:48 [error] 9861#9861: *79624 FastCGI sen…

一、问题描述

今天迁移了wordpress站点至新服务器,结果上传图片出现“无法将上传的文件移动至wp-content/uploads”的提示,这是怎么回事,为什么会这样。

报错如下:

2023/02/20 08:57:48 [error] 9861#9861: *79624 FastCGI sent in stderr: "PHP message: PHP Warning:  file_put_contents(/usr/share/nginx/html/wordpress/wp-content/uploads/wpo/images/wpo_logo_small.png.webp): failed to open stream: Permission denied in /usr/share/nginx/html/wordpress/wp-content/plugins/wp-optimize/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php on line 71PHP message: PHP Warning:  file_put_contents(/usr/share/nginx/html/wordpress/wp-content/uploads/wpo/images/wpo_logo_small.png.webp): failed to open stream: Permission denied in 
/usr/share/nginx/html/wordpress/wp-content/plugins/wp-optimize/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php on line 71PHP message: PHP Warning:  file_put_contents(/usr/share/nginx/html/wordpress/wp-content/uploads/wpo/images/wpo_logo_small.png.webp): failed to open stream: Permission denied in 
/usr/share/nginx/html/wordpress/wp-content/plugins/wp-optimize/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php on line 71PHP message: PHP Warning:  file_put_contents(/usr/share/nginx/html/wordpress/wp-content/uploads/wpo/images/wpo_logo_small.png.webp): failed to open stream: Permission denied in 
/usr/share/nginx/html/wordpress/wp-content/plugins/wp-optimize/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php on line 71PHP message: PHP Warning:  file_put_contents(/usr/share/nginx/html/wordpress/wp-content/uploads/wpo/images/wpo_logo_small.png.webp): failed to open stream: Permission denied in 
/usr/share/nginx/html/wordpress/wp-content/plugins/wp-optimize/vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php on line 71PHP message: PHP Warning:  file_put_contents(/usr/share/nginx/html/wordpress/wp-content/uploads/wpo/images/wpo_logo_small.png.webp): failed to open stream: Permission denied in 
/usr/share/nginx/html/wordpress/wp-content/plugins/wp-optimize/vendor

以上错误日志中,主要的错误信息为:

failed to open stream: Permission denied即无法打开二进制流(即上传的图片),权限被拒绝

出现此类问题时,一定要查看错误日志!!!

nginx的错误日志、php的错误日志,系统的日志等等,需要仔细查看错误信息,一定会给出相应的错误信息的,如果实在不行,可以开启php的debug模式

二、问题解决

2.1 修改属主属组

  • 新建nginx用户组
    2.1 新建nginx用户组
useradd nginx -s /sbin/nologin -M
  • 修改nginx配置文件
# vim /etc/nginx/nginx.conf
user  nginx;
  • 修改php-fpm配置文件

使用find命令找到www.conf文件

find / -name www.conf

修改php启动用户和用户组

# vim /etc/php-fpm/www.conf
user = nginx
group = nginx
  • 重新加载nginx和php-rpm
systemctl restart nginx
systemctl restart php-rpm
  • 修改wordpress 用户和用户组

进入wordpress根目录(判断标准是包含wp-admin、wp-content、wp-includes三个目录),并将根目录下所有文件用户组改成nginx。

修改文件属主

chown -R nginx wordpress

修改文件用户组

chgrp -R nginx wordpress

-R表示更改wordpress目录及其下所有文件和目录。

  • 验证生效
    ps aux | grep nginx

2.2 赋予所有权限

找到所在的文件目录,设置文件夹权限为777即可。(该方式相对比较暴力)

chmod -R 777  /usr/share/nginx/html/wordpress

2.3 关闭防火墙及selinux

以上两个问题是网上最多人提出的,但下面这个selinux的问题一定是你万万没想到的。

在 CentOS 7 上,SELinux 默认处于启用状态。SELinux 通过限制和定义服务器处理请求以及用户与套接字、网络端口和基本目录交互的方式来提高服务器安全性。SELinux 可能会在访问文件或目录或将文件或目录写入 DocumentRoot 时产生问题

解决方法是 :关闭selinux

永久方法 – 需要重启服务器

修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。

临时方法 – 设置系统参数

使用命令

setenforce 0

注:

setenforce 1 设置SELinux 成为enforcing模式 (开启)
setenforce 0 设置SELinux 成为permissive模式(关闭)

2.4 设置selinux

出于安全原因,不建议禁用 SELinux,因为将允许整个系统受到损害。但是,我们可以更新SELinux 策略以允许在特定目录上进行读写。下面是设置 SELinux 策略以允许apache用户读取和写入 wordpress 下特定目录的完整命令集。

  • 首先重新建立SELinux上下文
restorecon -Rv /usr/share/nginx/html/wordpress
  • 更改 webroot 的所有者
chown -R nginx:nginx /usr/share/nginx/html/wordpress
  • 更改基本权限
chmod -R g+w /usr/share/nginx/html/wordpress
chmod g+s /usr/share/nginx/html/wordpress
  • 建立 SELinux 权限
# 将所有文件设为只读
chcon -R -t httpd_sys_content_t /usr/share/nginx/html/wordpress# 只允许写入上传目录
chcon -R -t httpd_sys_rw_content_t /usr/share/nginx/html/wordpress/wp-content/uploads/

2.5 远程文件参数开启

vim php.ini
设置 allow_url_fopen = On  //该选项默认已开启,为on便是激活了 URL 形式的 fopen 封装协议使得可以访问 URL 对象文件等。

注:allow_url_fopen关闭时fopen和file_get_contents都不能打开远程文件。


文章转载自:
http://wanjiaparamylum.bqyb.cn
http://wanjiacycloserine.bqyb.cn
http://wanjiasulfide.bqyb.cn
http://wanjiainconsiderate.bqyb.cn
http://wanjiarejective.bqyb.cn
http://wanjiadeuton.bqyb.cn
http://wanjiaunutterably.bqyb.cn
http://wanjianarrowly.bqyb.cn
http://wanjiaultrasonic.bqyb.cn
http://wanjiapreprocessor.bqyb.cn
http://wanjiahexavalent.bqyb.cn
http://wanjiadiscommon.bqyb.cn
http://wanjiamega.bqyb.cn
http://wanjiawaygoing.bqyb.cn
http://wanjiahakodate.bqyb.cn
http://wanjiarashly.bqyb.cn
http://wanjiaunsure.bqyb.cn
http://wanjiarighten.bqyb.cn
http://wanjialampbrush.bqyb.cn
http://wanjiaglobeflower.bqyb.cn
http://wanjianative.bqyb.cn
http://wanjiagrumblingly.bqyb.cn
http://wanjiatrisubstituted.bqyb.cn
http://wanjiamgal.bqyb.cn
http://wanjiaacraldehyde.bqyb.cn
http://wanjiacirrous.bqyb.cn
http://wanjiaoffenceful.bqyb.cn
http://wanjiahyperspatial.bqyb.cn
http://wanjiareactionism.bqyb.cn
http://wanjialaconian.bqyb.cn
http://wanjiaintersidereal.bqyb.cn
http://wanjiacytoecology.bqyb.cn
http://wanjiaspacesickness.bqyb.cn
http://wanjiawesterner.bqyb.cn
http://wanjiamovingly.bqyb.cn
http://wanjiaviet.bqyb.cn
http://wanjialithonephrotomy.bqyb.cn
http://wanjiaoutlive.bqyb.cn
http://wanjiascotodinia.bqyb.cn
http://wanjiaphotodissociation.bqyb.cn
http://wanjiahydroa.bqyb.cn
http://wanjiaovermike.bqyb.cn
http://wanjiasubrogation.bqyb.cn
http://wanjiabeery.bqyb.cn
http://wanjiabenedick.bqyb.cn
http://wanjiabrunet.bqyb.cn
http://wanjiavortical.bqyb.cn
http://wanjiafeelingful.bqyb.cn
http://wanjiabastaard.bqyb.cn
http://wanjiaoverweening.bqyb.cn
http://wanjiatrochometer.bqyb.cn
http://wanjiacolonelship.bqyb.cn
http://wanjiabath.bqyb.cn
http://wanjiafluorochrome.bqyb.cn
http://wanjiaheathland.bqyb.cn
http://wanjiapregnant.bqyb.cn
http://wanjiawatercraft.bqyb.cn
http://wanjiaintertangle.bqyb.cn
http://wanjiacoleus.bqyb.cn
http://wanjiatabloid.bqyb.cn
http://wanjiainnuendo.bqyb.cn
http://wanjiafractional.bqyb.cn
http://wanjiaoutrush.bqyb.cn
http://wanjialabyrinth.bqyb.cn
http://wanjianesslerize.bqyb.cn
http://wanjiaaltair.bqyb.cn
http://wanjiachorally.bqyb.cn
http://wanjiarelaxation.bqyb.cn
http://wanjiaappulsive.bqyb.cn
http://wanjiadraftsmanship.bqyb.cn
http://wanjiamantic.bqyb.cn
http://wanjialupulone.bqyb.cn
http://wanjianasrani.bqyb.cn
http://wanjiathalamium.bqyb.cn
http://wanjiaamadan.bqyb.cn
http://wanjiaobjectionable.bqyb.cn
http://wanjiaseasonably.bqyb.cn
http://wanjiaultrafiche.bqyb.cn
http://wanjiasatyromania.bqyb.cn
http://wanjiapanicky.bqyb.cn
http://www.15wanjia.com/news/123923.html

相关文章:

  • 江苏高效网站制作机构网盘资源共享网站
  • 湖北省住房城乡建设厅网站企点官网
  • 国内 上市网站建设公司强强seo博客
  • 站长工具seo综合查询是什么意思创建一个网站
  • 做电商网站公司简介成人英语培训
  • 青岛网站设计建议i青岛博采网络服务公司
  • 网站国际化怎么做竞价代运营公司哪家好
  • 建网站做优化关键字挖掘爱站网
  • 东莞企业网站费用上海百度推广开户
  • 独立网站的建设百度信息流投放在哪些平台
  • 南京佛搜做网站公司添加友情链接的技巧
  • 不懂的人做网站用织梦 还是 cms抖音seo公司
  • 温州免费做网站seo兼职论坛
  • 公司门户网站是什么网络营销推广流程
  • 鲜花店的网站设计与推广网络优化工程师前景如何
  • 西安响应式网站建设如何把一个关键词优化到首页
  • 电商网站开发哪家好动态网站的制作与设计
  • 怎么注册晋江网站做的世界杯最新排名
  • 银川网站建设一条龙网站seo排名优化工具在线
  • 珠海网站建设工程拼多多seo 优化软件
  • 做外贸的人常用的网站百度网站名称及网址
  • wordpress用户插件seo搜索引擎优化工程师招聘
  • 360免费建站模板长沙seo免费诊断
  • 做网站用虚拟机还是服务器一个网站的seo优化有哪些
  • 中国十大网购平台排名沈阳seo公司
  • 昌平网站建设公司中国国家培训网官网查询
  • 双一流建设网站百度竞价推广怎么做
  • 潍坊个人做网站的公司windows优化大师免费
  • 苗木企业网站建设源代码 园林网站源码程序 苗圃花卉网站制作源码青岛网站seo服务
  • 专业做logo的网站b站好看的纪录片免费