求助debian下lnmp装WP 后台404错误 已经755
这个网站搭建好后,一段时没去管理,今天登陆后台后,想发布一篇文章,可在进行添加文章的操作时,发现竟然出现404的错误,在网上参考一下人家的资料,并仔细观察了下,果然是在后台操作时,当你进行任意一个点击动作时(如写文章),会发现左下角显示的链接中都少了一段代码:“wp-admin” 于是去官方找参考答案,发现只要通过vim修改一下Nginx下的wordpress.conf 这个配置文件即可,在它的尾部加上一段 rewrite /wp-admin$ $scheme://$host$uri/ permanent; 这个代码即可具体操作步骤:1,远程登陆你的vps ,我这里用的是xshell这个软件,然后输入 vim /usr/local/nginx/conf/wordpress.conf 如下图所示进入后,按 i 键 ,然后后光标移动到尾部,输入 rewrite /wp-admin$ $scheme://$host$uri/ permanent; 用 :wq 保存退出即可,如下图最后要重启nginx 才能生效 可以执行这条命令 /root/lnmp restart 。
LNMP nginx配置伪静态规则
第一步、准备伪静态脚本。
server { listen 80; server_name laozuo.org; server_name_in_redirect off; access_log /var/log/nginx/localhost.access_log main; error_log /var/log/nginx/localhost.error_log info; root PATH_ON_SERVER; index index.php index.html index.htm default.html default.htm; # Support Clean (aka Search Engine Friendly) URLs location / { try_files $uri $uri/ /index.php$args; } # deny running scripts inside writable directories location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi.conf; } # caching of files location ~* \.(ico|pdf|flv)$ { expires 1y; } location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ { expires 14d; }} 第二步,修改文件。
/usr/local/nginx/conf/vhost/www.laozuo.org.conf 这个文件是在添加域名站点时候自动生成的,然后修改这个脚本为第一步的伪静态文件,全部替换就OK。
这样把所有的伪静态都写入的,而没有像wordpress采用调用的方式。
效果是一样的。
第三步、重启LNMP。
/root/lnmp restart
用lnmp架构搭建电影网站怎么报404错误
解决分类目录和标签打开错误:1、在wp-includs文件夹下面,找到rewrite.php文件,复制保存或者下载下来。
保存一下,防止修改出处,万一出错了,可以覆盖还原。
2、然后用记事本打开rewrite.php文件,找到这个函数名:function get_category_permastruct()(大约在970行),代码如下:functionget_category_permastruct(){if(isset($this->category_structure))return$this->category_structure;if(empty($this->permalink_structure)){$this->category_structure=”;returnfalse;}if(empty($this->category_base))$this->category_structure=trailingslashit($this->front.'category' );else$this->category_structure=trailingslashit('/' .$this->root.$this->category_base);$this->category_structure.='%category%';return$this->category_structure;}3、然后在这个下面找到if(empty($this->permalink_structure))把这个改为if(!empty($this->permalink_structure))注意,这里只加了一个英文‘!’解决了wordpress分类目录404错误的问题。
4、再找到这个函数function get_tag_permastruct()(大约在986行),里面也有一个if(empty($this->permalink_structure))一样,还是改为if(!empty($this->permalink_structure))这里只加了一个英文‘!’解决了wordpress的tag标签404错误的问题。
至此所有的问题都解决了,看看是不是很简单啊!5、有些同学打开3.2.1版rewrite.php文件的时候,可能没有发现上述方法中的代码,而是如下的内容:functionget_category_permastruct(){return$this->get_extra_permastruct('category');}应该是对代码进行了优化。
往下找,找到了function get_extra_permastruct($name),代码如下:functionget_extra_permastruct($name){if(empty($this->permalink_structure))returnfalse;if(isset($this->extra_permastructs[$name]))return$this->extra_permastructs[$name][0];returnfalse;}6、对这段代码进行修改,添加个英文”!”即可,改为如下形式:functionget_extra_permastruct($name){if(!empty($this->permalink_structure))returnfalse;if(isset($this->extra_permastructs[$name]))return$this->extra_permastructs[$name][0];returnfalse;}即把代码if(empty($this->permalink_structure))中的empty前加上英文的惊叹号“!”上传覆盖掉原来的文件即可完美解决设置固定链接后分类目录和标签的404错误问题。
wordpress安装在lnmp的什么路径下
简洁版:1:LNMP环境上用WP搭建网站需要那种缓存组合看2:日IP1000的阿里云ECS需要什么配置看详细版:新人,VPS重装无数次之后网站终于可以访问了。
最开始用的是LAMP,但是后来看到Nginx比Apache好,前几天开始换了LNMP,用的是的一键安装包。
最近一直在看相关博客,了解到Tcmalloc、Jemalloc、eAccelerator、xcache、memcached、imageMagick、ionCube、redis、opcache再加上WP super cache,我应该如何搭配看阿里云的ECS,配置是最低的1核512M内存,1M带宽,通过IP访问,用Chrome测试的加载时间是10s左右(WP主题是Avada)。
网站上线后预计日IP1000应该会达到,我要不要升到1G内存和2M带宽。
转载请注明出处51数据库 » lnmp wordpress 404
亖呉?盀